4 ms·
If there's no newline, cat won't output one, and bash will put the prompt right after: [dale@host ~]$ echo -n "hi" > test [dale@host ~]$ cat test h
by dale_glass 3y ago
If there's no newline, cat won't output one, and bash will put the prompt right after:
[dale@host ~]$ echo -n "hi" > test
[dale@host ~]$ cat test
hi[dale@host ~]$
If you add a \r, then the cursor goes back to the start of the line, and the prompt overwrites the "hi".
[dale@host ~]$ echo -en "hi\r" > test
[dale@host ~]$ cat test
[dale@host ~]$