当前位置: 技术问答>linux和unix
请教高手:shell字符串比较问题
来源: 互联网 发布时间:2016-12-08
本文导语: //如下为tmp.sh sysdb_user= sysdb_passwd= cms_enabler_url= ctrl_int4value= IFS=' ' while read f1 f2 f3 do echo "f1 = $f1, f2=$f2, f3=$f3" if (($f1=="sysdb")) then echo "sysdb_user = $f2" ...
//如下为tmp.sh
sysdb_user=
sysdb_passwd=
cms_enabler_url=
ctrl_int4value=
IFS=' '
while read f1 f2 f3
do
echo "f1 = $f1, f2=$f2, f3=$f3"
if (($f1=="sysdb"))
then
echo "sysdb_user = $f2"
echo "sysdbpwd = $f3"
elif (($f1=="SID"))
then
echo "sid = $f3"
elif (($f1=="NAME"))
then
echo "name = $f3"
else
echo "not find"
fi
done
sysdb_user=
sysdb_passwd=
cms_enabler_url=
ctrl_int4value=
IFS=' '
while read f1 f2 f3
do
echo "f1 = $f1, f2=$f2, f3=$f3"
if (($f1=="sysdb"))
then
echo "sysdb_user = $f2"
echo "sysdbpwd = $f3"
elif (($f1=="SID"))
then
echo "sid = $f3"
elif (($f1=="NAME"))
then
echo "name = $f3"
else
echo "not find"
fi
done