[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] here-doc / linebreaks / indirect expansion
From: |
kardan |
Subject: |
Re: [Help-bash] here-doc / linebreaks / indirect expansion |
Date: |
Mon, 24 Jun 2013 10:28:56 +0200 |
Am Sun, 23 Jun 2013 21:11:35 -0400
schrieb Chet Ramey <address@hidden>:
> On 6/23/13 4:27 AM, kardan wrote:
>
> > The substitution error is still unclear to me.
> >
> > var=DISPLAY ; echo "$var=${!DISPLAY} === $var=${!$var}"
>
> OK. Let's say that DISPLAY has the value ':0'. The way indirect
> expansion works is that the value of the indirected variable is used
> as the (new) name of the variable to be expanded. So this turns
> into, in effect,
>
> echo "$var=${:0} ..."
>
> which is clearly a substitution error. If you want to get the output
> you showed, don't use indirect expansion on DISPLAY.
Thanks! I found, that echo ${!var} does what i want. Kardan