[TriLUG] bash question
anball at gmail.com
Wed Oct 17 15:40:28 EDT 2007
adball at adball-cs:~$ $("echo foo | $cmd")
Usage: command-not-found [options] <command-name>
command-not-found: error: no such option: -v
bash: echo foo | | grep -v one | grep -v two | grep -v three: command not
adball at adball-cs:~$ echo $cmd
| grep -v one | grep -v two | grep -v three
adball at adball-cs:~$
On 10/17/07, Joseph Mack NA3T <jmack at wm7d.net> wrote:
> 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!
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
Andrew D. Ball
More information about the TriLUG