|
# ls -l
total 708
drwxrwxrwx 2 root wheel 512 9 11 08:31 7770
-rwxr-xr-x 1 root wheel 2860 8 30 21:44 XF86Config
-rw-r--r-- 1 root wheel 3344 9 27 18:58 back.jpg
-rwxr-xr-x 1 root wheel 298 9 20 05:01 boot.ini
-rwx------ 1 root wheel 367 10 5 10:02 check
-rw-r--r-- 1 root wheel 6903 9 18 22:25 fs
lrwxr-xr-x 1 root wheel 2 9 19 22:04 fs0 -> fs
-rw-r--r-- 1 root wheel 6903 9 19 22:05 fs00
lrwxr-xr-x 1 root wheel 13 9 12 06:18 l -> /share/test/t
-rw-r--r-- 1 root wheel 671744 8 30 22:07 nmap-3.30.tar.bz2
-rw-r--r-- 1 root wheel 13 10 5 09:47 ok0
drwxr-xr-x 2 root wheel 512 9 20 04:11 src
drwxr-xr-x 2 root wheel 512 9 29 11:46 xingzuo
# file oko
oko: can't stat `oko' (No such file or directory).
# echo $?
0
# test -r okok
# echo $?
1
# cp /okokkokok /etc/
cp: /okokkokok: No such file or directory
# echo $?
1
# file wrong
wrong: can't stat `wrong' (No such file or directory).
# echo $?
0
# [ -r fs ]
# echo $?
0
为什么错误cp 就产生0,而file错误就没有 :ask :ask
bash-2.05b# a=ok
bash-2.05b# expr $ok + 1 >/dev/null
expr: syntax error
bash-2.05b# echo $?
2
bash-2.05b#
这里的 echo $? 的值是2 ,:ask :ask
|
|