[英]How to write end of file with new line in linux?
I want to write, a script output into logfile at the end with new line..我想写一个脚本输出到日志文件的末尾,并带有新行..
with this command, it replace the file.使用此命令,它会替换文件。
echo "hai" > /tmp/syslog.txt
but I need add "hai" with existing file content at the end with new line..但我需要在新行的末尾添加带有现有文件内容的“hai”。
thanks in advance..提前致谢..
just simple like this:就像这样简单:
echo "hai" >> /tmp/syslog.txt
:) :)
使用选项\\n
- 带有退格解释器的新行-e
从使用它的地方处理新行。
echo -e "\nHai" >> /tmp/syslog.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.