- 论坛徽章:
- 0
|
进solaris看了下,不管/bin/sh还是/usr/bin/sh都是/sbin/sh的软链接
lrwxrwxrwx 1 root 13 2007-03-05 03:30 /usr/bin/sh -> ../../sbin/sh
lrwxrwxrwx 1 root 13 2007-03-05 03:30 /bin/sh -> ../../sbin/sh
查看了下solaris下的man test,里面有
-e file True if file exists. (Not available in sh.)
所以sh里面test不支持-e参数
还有这么一段话
Using -e option in sh
Example 6: Using /usr/bin/test for the -e option
If one really wants to use the -e option in sh, use
/usr/bin/test, as in the following:
if [ ! -h $PKG_INSTALL_ROOT$rLink ] && /usr/bin/test -e
$PKG_INSTALL_ROOT/usr/bin/$rFile ; then
ln -s $rFile $PKG_INSTALL_ROOT$rLink
fi
也就是/bin/test是不支持-e参数,但是/usr/bin/test可以支持- $ touch sdfas
- $ test -e sdfas && echo 111
- test: 需要参数
- $ /usr/bin/test -e sdfas && echo 111
- 111
复制代码 所以用/usr/bin/test,要用[的话,也许将/bin/test做个软链接到/usr/bin/test可以 |
|