Larry Cook writes:

> I'm being stupid!  Can someone please help?
>
> I've got a BASH script with the following:
>
>      CMD="zcat myfile | tar xf -"
>      $CMD
>
> This puts zcat's output to stdout, rather than piping it to tar like I
> want. 

This is because the shell's order of operations is different than what
you think it is.  The man pages describes this in gory detail.

> Now I'm sure this is how it *should* work. :-(  Unfortunately, I
> can't figure out how to get it to work like I want.

You could either just invoke "zcat myfile | tar xf -" directly (but I
guess you have some reason why you can't do that) or else you could
just try "eval $CMD".

Hope this helps,

--kevin
-- 
GnuPG ID: B280F24E                     And the madness of the crowd
alumni.unh.edu!kdc                     Is an epileptic fit
                                       -- Tom Waits
_______________________________________________
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss

Reply via email to