如果正确的格式是什么?
我尝试了很多品种。
如果不在程序中,格式应该在命令行上工作吗?
$ if [1==2] then echo "y" fi;
> ;
-bash: syntax error near unexpected token `;'
试试这个:
if [ 1 == 2 ]; then echo "y" ; fi
最好使用-eq
,除非您想将1和2作为字符串进行比较。
有用的链接:http : //tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句