我想将其打印到文件中
echo "hello world "today"" > /tmp/file.log
导致/tmp/file.log
hello world "today"
答案1
您可以通过多种方式实现此目的
$ echo "hello world \"today\"" > /tmp/file.log
$ cat /tmp/file.log
hello world "today"
$ echo 'hello world "today"' > /tmp/file.log
$ cat /tmp/file.log
hello world "today"