shell脚本中“if”语法如何嵌套?
回复可见**** Hidden Message *****
空格 https://www.zhihu.com/question/385416783可以参考这条知乎回答,比较全面的。 if [ $packetanal_ver != 'yechang' ];then
packetpid=`ps aux|greppacketAnal|grep -v "grep"|awk '{print $2}'`
if [ "$packetpid" ];then
kill -9 $packetpid
echo "old packetAnal is killed" if [ $packetanal_ver != 'yechang' ];then
packetpid=`ps aux|greppacketAnal|grep -v "grep"|awk '{print $2}'`
if [ "$packetpid" ];then
kill -9 $packetpid
echo "old packetAnal is killed"
if [ $packetanal_ver != 'yechang' ];then
packetpid=`ps aux|greppacketAnal|grep -v "grep"|awk '{print $2}'`
if [ "$packetpid" ];then
kill -9 $packetpid
echo "old packetAnal is killed" 没理解,按照语法来啊
页:
[1]