shell脚本读取配置文件
来源:互联网 发布:简单的数据库设计 编辑:程序博客网 时间:2024/05/16 00:54
我现在有个配置文件config,里面内容为
ID=123
IP=192.168.3.154
Name=test
想写个shell脚本,把这几个变量的值给读出来
高手指点下
Answer:
[root@RHEL6A shcode]# more config
ID=123
IP=192.168.3.154
Name=test
[root@RHEL6A shcode]# echo $ID
0
[root@RHEL6A shcode]# more sh13.sh
#!/bin/bash
source config
echo $ID
echo $IP
echo $Name
[root@RHEL6A shcode]# ./sh13.sh
123
192.168.3.154
Name
提供3种方法
while read -r line
do
eval "$line"
done < configfile
echo $ID
#id=`sed '/^ID=/!d;s/.*=//' configfile`
#echo $id
source configfile
echo $ID
- shell脚本读取配置文件
- shell脚本读取配置文件
- shell脚本读取配置文件
- shell脚本读取ini配置文件的值
- shell脚本读取ini配置文件的值
- 如何用shell脚本读取配置文件
- Shell脚本读取ini配置文件实例教程
- linux shell 脚本读取 ini 配置文件
- 读取配置文件的shell脚本实现
- shell脚本读取ini配置文件的值
- shell脚本按行读取配置文件并解析
- shell 读取配置文件
- shell读取配置文件
- linux shell 读取配置文件
- linux shell 读取配置文件
- shell读取ini配置文件
- bat脚本读取配置文件
- shell脚本读取文件
- 苹果新专利获批
- DWR学习笔记(一)
- Phone重绘机制drawRect
- ActiveMQ学习笔记(二) JMS与Spring
- 网络文件夹目前是以其他用户名和密码进行映射的
- shell脚本读取配置文件
- GDI+ 笔记
- Android HAL分析与开发
- php -- 字符串函数
- JAVA反射机制
- ActiveMQ 安装配置
- 如何写一份良好的缺陷(Bug)报告
- 社交网络:数据科学家眼中的金矿
- 压缩传感的系列论文和点评