Hello,
I tried to set newline chars at the end of a variable.
But it does not seem to be possible:
$ IFS="" x="$(echo -en "www\n\n\n")"; echo -n "$x" | xxd
0000000: 7777 77 www
$
I figured out that any ending newline chars are cut, but not the chars
in the front nor between. So I added a space after a newline and
removed it again, this works:
| |||||||||||
v vvvvvvvvvvv
$ IFS="" x="$(echo -en "www\n\n\n ")"; x="${x% }"; echo -n "$x" | xxd
0000000: 7777 770a 0a0a www...
$
How do I add newlines at the end of a string without "bad tricks" ?
Greetings,
Alexander
--
Alexander Elgert
Public Gruppe
RechnerBetriebsGruppe TU Darmstadt (FB 20) Tel: +49 06151 16-4333
Raum: S1/13 11a (alt 25/11a)
FAQ2: http://www.informatik.tu-darmstadt.de/RBG/service/FAQ2/