echo while read umask 問題 - Linux

Table of Contents

最近在看LPIC考題
有兩題比較有問題

1.以下的指令序列將會輸出甚麼?
echo '1 2 3 4 5 6' | while read a b c; do
echo result: $c $b $a;
done

答案是:result: 3 4 5 6 2 1

為什麼呢~? 我認為是 3 2 1 6 5 4

2.你希望設定你的檔案的預設權限為-rw-r-----。以下那個是對umask最有用的設定

解答寫:027

我認為是127啊~~~~
為什麼呢?


--

All Comments

Enid avatarEnid2013-10-14
因為3 4 5 6都是c
Puput avatarPuput2013-10-16
你可以在$c $b $a中間都加個-看一下就知道了
Poppy avatarPoppy2013-10-20
回一下2
Mary avatarMary2013-10-21
你可以umask 127試試 檔案本身預設就沒有x
不過這裡遇到資料夾你就會想哭了(笑