help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] here-doc / linebreaks / indirect expansion


From: Chet Ramey
Subject: Re: [Help-bash] here-doc / linebreaks / indirect expansion
Date: Sun, 23 Jun 2013 21:11:35 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130328 Thunderbird/17.0.5

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.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]