简体   繁体   English

如何使用Linux命令将引号/单引号标点写入文件

[英]how to write quote / single quote punctuation to file with Linux command

I want to write " or ' into a file with ECHO "\\" " >> file.txt command in linux, but it showed me output redirector operator > , instead of writing the " into file. And I am not able to exit > status and back to 我想在Linux中使用ECHO "\\" " >> file.txt命令将”或'写入文件,但是它向我显示了输出重定向程序操作符> ,而不是将“”写入了文件。而且我无法退出>状态并返回

vagrant@vagrant-ubuntu-trusty-64:~$ vagrant @ vagrant-ubuntu-trusty-64:〜$

Is there anyone know how to insert single quote or quote into a file and exit >? 有谁知道如何在文件中插入单引号或引号并退出>? Thanks. 谢谢。

You can escape it using a backslash . 您可以使用backslash将其backslash

Try this: 尝试这个:

echo \' >> a.txt 
echo \" >> a.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM