Command substitution failure - why?

ABrady xunil at kc.rr.com
Sun Nov 14 22:54:03 UTC 2004


On Sun, 14 Nov 2004 15:56:33 -0600 (CST)
Vidiot <brown at mrvideo.vidiot.com> wrote:

> I'm using zsh/
> 
> When I enter the following on the command line, I get the expected
> result:
> 
> 	echo ann001.jpg | awk "{ print substr(\$0, 1, length(\$0) -7 )
> 	}"
> 
> Expect result = ann
> 
> But, when I do this:
> 
> 	OUT=`echo ann001.jpg | awk "{ print substr(\$0, 1, length(\$0)-	-7 ) }"`
> 
> I get back nothing.  The variable is empty.
> 
> Anyone have an idea as to why the aboce isn't working?

Have you tried:

    export OUT=`echo ann001.jpg | awk "{ print substr(\$0, 1,length(\$0) -7 ) }"`

and then looked to see what the variable reads?




More information about the redhat-list mailing list