linux shell 脚本读取 ini 配置文件
来源:互联网 发布:欧陆风云4mac汉化补丁 编辑:程序博客网 时间:2024/05/20 13:19
linux shell 脚本读取 ini 配置档打码如下:
#!/bin/bashconfigFile="./config.ini"function ReadINIfile() { Key=$1Section=$2 Configfile=$3ReadINI=`awk -F '=' '/\['$Section'\]/{a=1}a==1&&$1~/'$Key'/{print $2;exit}' $Configfile` echo "$ReadINI" } itemCount=`ReadINIfile "ItemCount" "General" "$configFile"`echo $itemCountfor((i=0; i<itemCount; i++))doSection="Item""$i"echo $SectionnumTest=`ReadINIfile "NumTest" "$Section" "$configFile"`stringTest=`ReadINIfile "StringTest" "$Section" "$configFile"`echo $numTestecho $stringTestdone
测试的ini配置档如下:
[General]ItemCount=2 [Item0]NumTest=100StringTest=for string test 0 [Item1]NumTest=111StringTest=for string test 1
测试结果如下:
2Item0100for string test 0Item1111for string test 1
0 0
- linux shell 脚本读取 ini 配置文件
- shell脚本读取ini配置文件的值
- shell脚本读取ini配置文件的值
- Shell脚本读取ini配置文件实例教程
- shell脚本读取ini配置文件的值
- shell读取ini配置文件
- shell脚本读取配置文件
- shell脚本读取配置文件
- shell脚本读取配置文件
- SHELL读取 ini 格式文件做配置文件
- Shell实现读取ini格式配置文件方法
- 脚本引擎之----读取INI配置文件
- 脚本引擎之----读取INI配置文件
- linux shell 读取配置文件
- linux shell 读取配置文件
- Linux下用C读取INI配置文件
- Linux C语言实现读取ini配置文件
- Linux下用C读取INI配置文件
- FFmpeg编译笔记
- Qt自总结(一) QThread
- mfc属性页
- [Python]解决UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0
- 使用 Azure Site Recovery 灾难恢复至 Azure 的功能现已正式发布
- linux shell 脚本读取 ini 配置文件
- JAVA 网络编程(简单的发送端和接受端)
- linux 组和用户
- skf_buff详解【转】
- 像少年一样去爱,像成人一样克制
- 将信息添加到指定的文本文件中
- 利用orange进行关联规则挖掘
- C++查缺补漏之变量和基本类型
- Android安装应用后点击,打开.(Open)带来的问题及解决方式