[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question: variables and newlines
From: |
Paul Jarc |
Subject: |
Re: Question: variables and newlines |
Date: |
Thu, 22 Aug 2002 13:51:21 -0400 |
User-agent: |
Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i686-pc-linux-gnu) |
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