0
我的工作,虽然这里的例子http://tldp.org/LDP/abs/html/debugging.html,想一些帮助解释为什么这个脚本引发错误的内部[37:找不到命令命令未找到错误的,如果[-gt] comparsion
#!/bin/bash
# ex74.sh
# This is a buggy script.
# Where, oh where is the error?
a=37
if [$a -gt 27 ]
then
echo $a
fi
exit $? # 0! Why?
'[$ a' - >'[$ a'。 ''''之前''''' – ymonad 2014-09-05 08:49:33
之前需要空格谢谢,为什么我需要一个空间,bash解释器认为[$ a是什么? – Dave 2014-09-05 08:54:53
在过去''''是'test'具有相同功能的命令。它目前是一个内建命令,但''/'/ usr/bin/['中的残差''。所以'test $ a -gt 27]'是好的,但'test $ a -gt 27]'是不好的。与'[$ a'相同 – ymonad 2014-09-05 09:05:05