【发布时间】:2023-03-30 16:14:02
【问题描述】:
我想用 1 行代码做到这一点:
创建一个文本文件,在其中放置 3 个句子。我知道创建空文本文件的命令是“cat > sample.txt”,但我想在一行代码中创建包含这 3 个句子的文件。 像这样:
sentence1
sentence2
sentence3
【问题讨论】:
我想用 1 行代码做到这一点:
创建一个文本文件,在其中放置 3 个句子。我知道创建空文本文件的命令是“cat > sample.txt”,但我想在一行代码中创建包含这 3 个句子的文件。 像这样:
sentence1
sentence2
sentence3
【问题讨论】:
echo -e "sentence1 \nsentence2 \nsentence3" >> sample.txt
【讨论】: