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: kardan
Subject: Re: [Help-bash] here-doc / linebreaks / indirect expansion
Date: Sun, 23 Jun 2013 10:27:31 +0200

Hi,

Am Sat, 22 Jun 2013 23:53:37 +0200
schrieb John Kearney <address@hidden>:

> Here Documents direct the text to stdin, you seem to be trying to
> assign it to a variable? if so just use double quotes.
The reason for this is that the info should be at the top of the code
but printed at the end. I just realized, that using a function with echo
"..." is just what I want. The cat-way does as well. Thanks!
The substitution error is still unclear to me. (The HERE-doc does not
work, neither with nor without embracing function. As I understood
you, it should print directly to STDOUT, but it doesn't.)

FIXME() { # the hint shall be indented in code and output. so the cosmetic 
empty line
echo " 
       FIXME call pattern() with pattern name instead of pattern value of a 
pattern (1 not $1):                               
       according to man BASH 'indirect expansion' ${!parameter} is expanded to 
$parameter"
man bash|grep "indirect  expansion" -B9 -A2 # bash 4.2                          
                                              
var=DISPLAY ; echo "$var=${!DISPLAY} === $var=${!$var}"
}
[...lot of code...]
FIXME() # maybe this is bad style though
exit

> > 3. My use of indirect substitution seems to be inappropriate.
> >
> > var=DISPLAY ; echo "$var=${!DISPLAY} === $var=${!$var}"
> >
> > > /usr/local/bin/logs: line 23: $var=${!DISPLAY} === $var=${!$va
> > > r}: bad substitution
> >
> > This is how it should look like:
> >
> > > DISPLAY=:0 === DISPLAY=:0



reply via email to

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