Posted on 2012-11-22 12:02
盛勝 閱讀(2270)
評(píng)論(0) 編輯 收藏 引用
cmd > file 把 stdout 重定向到 file 文件中
cmd >> file 把 stdout 重定向到 file 文件中(追加)
cmd 1> file 把 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
這里重定向比較全了
STDIN 0 標(biāo)準(zhǔn)輸入 鍵盤 命令在執(zhí)行時(shí)所要的輸入數(shù)據(jù)通過它來取得
STDOUT 1 標(biāo)準(zhǔn)輸出 顯示器 命令執(zhí)行后的輸出結(jié)果從該端口送出
STDERR 2 標(biāo)準(zhǔn)錯(cuò)誤 顯示器 命令執(zhí)行時(shí)的錯(cuò)誤信息通過該端口送出

