小编Ilv*_*lvP的帖子

如何在文件中将文字 \n 作为来自终端的文本写入?

我在终端写这个:

printf ' \n\necho -e \"writes (>> appends) in note.txt this text'\n'on 2lines (with "-e" and "'\n'" help)\" >> note.txt\n' > note.txt 
Run Code Online (Sandbox Code Playgroud)

我得到了这个note.txt

echo -e "writes (>> appends) in note.txt this textnon 2lines (with "-e" and "n" help)" >> note.txt
Run Code Online (Sandbox Code Playgroud)

我想把它放进去note.txt

echo -e "writes (>> appends) in note.txt this text\non 2lines (with "-e" and "\n" help)" >> note.txt
Run Code Online (Sandbox Code Playgroud)

( \- 不见了)

command-line bash

5
推荐指数
3
解决办法
1万
查看次数

标签 统计

bash ×1

command-line ×1