-1

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..

thanks in advance..

jww
  • 97,681
  • 90
  • 411
  • 885
  • [How to append output to the end of a text file](https://stackoverflow.com/q/6207573/608639), [Append file contents to the bottom of existing file in Bash](https://stackoverflow.com/q/13181725/608639), etc. – jww Apr 22 '19 at 08:23
  • 2
    Possible duplicate of [How to append output to the end of a text file](https://stackoverflow.com/questions/6207573/how-to-append-output-to-the-end-of-a-text-file) – Tonio Apr 22 '19 at 08:40

2 Answers2

3

just simple like this:

echo "hai" >> /tmp/syslog.txt

:)

shih alex
  • 71
  • 1
  • 8
-1

Using option \n – New line with backspace interpreter -e treats new line from where it is used.

echo -e "\nHai" >> /tmp/syslog.txt
Ketan
  • 1,530
  • 7
  • 16