Shell—輸入輸出重定向

大多數 UNIX 系統命令從你的終端接受輸入並將所產生的輸出發送回​​到您的終端。一個命令一般從一個叫標準輸入的地方讀取輸入,默認狀況下,這剛好是你的終端。一樣,一個命令一般將其輸出寫入到標準輸出,默認狀況下,這也是你的終端。bash

輸出重定向spa

有兩種方式blog

  • [root@localhost ~]# command1 > file1       會覆蓋文件原來內容
  • [root@localhost ~]# command1 >> file2     不會覆蓋文件原來內容,追加到文件末尾
[root@localhost ~]# cat /etc/passwd | grep "root" > test.sh
[root@localhost ~]# cat /etc/passwd | grep "root" >> test.sh

輸入重定向class

相關文章
相關標籤/搜索