[TriLUG] bash question

Joseph Mack NA3T jmack at wm7d.net
Wed Oct 17 15:18:14 EDT 2007

On Wed, 17 Oct 2007, Andrew Ball wrote:

> Would something like the following do ?

adball at adball-cs:~$ cmd=""
adball at adball-cs:~$ for e in $exclude
> do
>   cmd="$cmd | grep -v $e"
>   echo "e: [$e] cmd: [$cmd]"
> done
e: [one] cmd: [ | grep -v one]
e: [two] cmd: [ | grep -v one | grep -v two]
e: [three] cmd: [ | grep -v one | grep -v two | grep -v three]
adball at adball-cs:~$ echo $exclude
one two three
adball at adball-cs:~$

I can construct $cmd this way, but when bash executes it, 
bash finds '|' and not | and sees '|' as a filename and not 
a pipe symbol. Did you get your line to execute?


Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!

More information about the TriLUG mailing list