cat與EOF實現文件內容的替換和追加

環境:用戶家目錄空文件

[xiaoshuai.zhu@localhost ~]$ pwd
/home/xiaoshuai.zhu
[xiaoshuai.zhu@localhost ~]$ ll
total 0

測試cat結合EOF實現文件新增

[xiaoshuai.zhu@localhost ~]$ cat << EOF >/home/xiaoshuai.zhu/note1.txt
測試cat結合EOF實現文件新增
EOF

查看文件內容
[xiaoshuai.zhu@localhost ~]$ cat note1.txt 
測試cat結合EOF實現文件新增

實現內容替換

[xiaoshuai.zhu@localhost ~]$ cat << EOF >/home/xiaoshuai.zhu/note1.txt
測試cat結合EOF實現文件的內容的替換覆蓋
EOF

查看文件內容
[xiaoshuai.zhu@localhost ~]$ cat note1.txt 
測試cat結合EOF實現文件的內容的替換覆蓋
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章