Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Sep 2001 21:25:30 -0700
From:      John Merryweather Cooper <john_m_cooper@yahoo.com>
To:        Mario Sergio Fujikawa Ferreira <lioux@uol.com.br>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: bug in shell `` expansion code?
Message-ID:  <20010921212530.G24650@johncoop.MSHOME>
In-Reply-To: <20010922011302.A44620@exxodus.fedaykin.here>; from lioux@uol.com.br on Fri, Sep 21, 2001 at 21:13:02 -0700
References:  <20010922011302.A44620@exxodus.fedaykin.here>

next in thread | previous in thread | raw e-mail | index | archive | help

On 2001.09.21 21:13 Mario Sergio Fujikawa Ferreira wrote:
> Hi,
> 
> 	While working on a make .mk code, I and Chris Wasser (TDF
> on IRC) came across an interesting behavior:
> 
> sh -c 'TDF="echo a && echo b";for i in `${TDF}`; do echo "i:$i"; done'
> 
> This should return:
> 
> i:a
> i:b
> 
> instead, it returns:
> 
> i:a
> i:&&
> i:echo
> i:b
> 
> 	If this is not a bug, how do we get it working?
> 
> 	Regards,
> 
> -- 
> Mario S F Ferreira - UnB - Brazil - "I guess this is a signature."
> lioux at ( freebsd dot org | linf dot unb dot br )
> flames to beloved devnull@someotherworldbeloworabove.org
> feature, n: a documented bug | bug, n: an undocumented feature
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message
> 

This works:

$ sh -c 'TDF="echo a && echo b";for i in `eval ${TDF}`; do echo "i:$i";
done'

I believe eval is necessary in this context, otherwise the && is not
"evaluated."  I checked, and the same behavior holds if sh is changed to
bash.

-- 
jmc

MacroHard -- the perfection of form over
             substance, marketing over
             performance, and greed over
             design . . .

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010921212530.G24650>