經安全檢測,此網站為安全網站,請放心前往原始網址!

問個關於while read的問題-Shell-ChinaUnix.net

$ cat test.sh #!/bin/sh a=123 echo '456' | while read line do echo $a echo $line a=$line done echo echo $a echo $line $ test.sh 123 456 456 $ 按我的理解,管道會起子shell,while迴圈應該在子shell中運行。 但實際看來,read的操作是在子shell中 ...

bbs.chinaunix.net

網址安全性掃描由 google 提供