k、exec 命令:常用來替代當前 shell 並重新啟動一個 shell,換句話說,並沒有啟動子 shell。使用這一命令時任何現有環境都將會被清除,。exec 在對文件描述符進行操作的時候,也只有在這時,exec 不會覆蓋你當前的 shell 環境。
2. 基本IO
cmd > file 把 stdout 重定向到 file 文件中
cmd >> file 把 stdout 重定向到 file 文件中(追加)
cmd 1> fiel 把 stdout 重定向到 file 文件中
cmd > file 2>&1 把 stdout 和 stderr 一起重定向到 file 文件中
cmd 2> file 把 stderr 重定向到 file 文件中
cmd 2>> file 把 stderr 重定向到 file 文件中(追加)
cmd >> file 2>&1 把 stderr 和 stderr 一起重定向到 file 文件中
cmd < file >file2 cmd 命令以 file 文件作為 stdin,以 file2 文件作為 stdout
cat <>file 以讀寫的方式打開 file
cmd < file cmd 命令以 file 文件作為 stdin
cmd << delimiter Here document,從 stdin 中讀入,直至遇到delimiter 分界符
閱讀更多 HelloWorld應用 的文章