Alexander Elgert <elgert@rbg.informatik.tu-darmstadt.de> wrote:
> 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
This is because of the command substitution, not the variable
assignment.
> How do I add newlines at the end of a string without "bad tricks" ?
You can't keep the newlines at the end of command substitution, but
you can put literal newlines in variables:
x="...
"
paul