Quote:
How do i add a "next line" or a \r\n in between the 2 string so that the newstring, when echo, will be
|
Note that \r\n is the “new line” for DOS/Windows only. On Unix/Linux, the new line is \n only, and on Mac (at least up to OS9, I don't know for OS10+) the new line is \r only.
If you want to force a DOS new line, then in my previous post, replace $'\n' with $'\r\n'.
Another thing, don't forget that bash and echo have a very HTML-like behaviour with blanks when quotes are omited*: any run of blanks, be it spaces or carriage returns or line feeds… or any mix, is replaced with a single character (the first character of the IFS environment variable, which usually is a space).
Example:
Code:
[yves@localhost ~]$ test1='this is
> test #1'
[yves@localhost ~]$ test2='that is
test #2'
[yves@localhost ~]$ echo $test1 $test2
this is test #1 that is test #2
[yves@localhost ~]$ echo "$test1" "$test2"
this is
test #1 that is
test #2
[yves@localhost ~]$ echo "$test1"$'\n'"$test2"
this is
test #1
that is
test #2
[yves@localhost ~]$ echo $test1$'\n'$test2
this is test #1
that is test #2
Yves.