1.覆蓋寫入
# 語法:echo '內(nèi)容' > 文件名或路徑
# 如向a.txt文件中輸入i love u
# 如果沒有這個文件則創(chuàng)建。如果有那么新內(nèi)容代替原來的內(nèi)容
echo 'i love u' > a.txt
2.追加寫入
# 語法:echo '內(nèi)容' >> 文件名或路徑
# 向a.txt文件中輸入i love u
# 如果沒有這個文件則創(chuàng)建.如果有那么新內(nèi)容追加在原來內(nèi)容的后面
echo 'i love u' >>a.txt
3.窗口輸出指定內(nèi)容
echo "hello" # 窗口輸出 hello
echo 'hello' # 窗口輸出 hello
文章來源地址http://www.zghlxwxcb.cn/news/detail-699169.html
文章來源:http://www.zghlxwxcb.cn/news/detail-699169.html
到了這里,關(guān)于Linux向文件中寫入內(nèi)容的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!