#!/bin/shprop_value=""function getProperty(){ file=$1 prop_key=$2 prop_value=`cat $file | grep -w ^${prop_key} | cut -d= -f2`}getProperty $1 $2echo $prop_value
age=23sex=男
运行
./GetProperty.sh test.cfg age
输出23
本文共 277 字,大约阅读时间需要 1 分钟。
#!/bin/shprop_value=""function getProperty(){ file=$1 prop_key=$2 prop_value=`cat $file | grep -w ^${prop_key} | cut -d= -f2`}getProperty $1 $2echo $prop_value
age=23sex=男
运行
./GetProperty.sh test.cfg age
输出23
转载于:https://www.cnblogs.com/windyWu/p/5095934.html