我在看bash 的manual page時
發現到下面2個地方弄得不是很清楚
1.
在講解REDIRECTION的那一段裡有提到
$ls > dirlist 2>&1
和
$ls 2>&1 > dirlist
這2個指令是不同的,原文的第2個指令說明是
direct only the standard output to file dirlist
原因是
because the standard error was duplicated as standard output 'before'
the standard output was redirected to dirlist
至於我對第2個指令的理解是
在standard output被重導到dirlist檔案後,standard error才被複製成
standard output,所以'before'應該是after才是!?
2.
在講內建變數的break指令的那一段後面
The return value is 0 unless the shell is not executing a loop
when break is executed.
這段話的意思應該在講說,如果break指令是在一個loop裡(for、while、until、select)
被執行的話,那麼最後的return value會是0,反之如果在loop以外執行的話
return value會是非0
不過我下了這行指令測試,跟我的理解有出入
$ break; echo $?
bash: break: only meaningful in a `for`, `while`, or `until` loop
0
我並沒有在loop裡執行break指令,但最後return value仍然是0
是我哪邊理解有誤呢??
thanks!!
--
※ Origin: SayYA 資訊站 <bbs.sayya.org>
◆ From: 61-228-97-200.dynamic.hinet.net