- 論壇徽章:
- 0
|
進(jìn)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參數(shù)
還有這么一段話
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參數(shù),但是/usr/bin/test可以支持- $ touch sdfas
- $ test -e sdfas && echo 111
- test: 需要參數(shù)
- $ /usr/bin/test -e sdfas && echo 111
- 111
復(fù)制代碼 所以用/usr/bin/test,要用[的話,也許將/bin/test做個(gè)軟鏈接到/usr/bin/test可以 |
|