os x or linux 里面的 /bin/[ 是什么命令?
是做什么用的?
$[
-bash: [: missing `]'
/bin 不是一个命令,是一个目录。是GNU/Linux or OS X放置系统必备软件的地方。
[
就是test
的别名。你输入man test
就可以看到写的是test, [ -- condition evaluation utility
在shell脚本里,if语句既可以写:
if test -d /home then #blabla fi
也可以写
if [ -d /home ] then #blabla fi
就是这个原因。所以[
后一定要有空格一下子就很好理解了对吧……