From owner-freebsd-hackers Fri Sep 21 23:15:40 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from ipperformance.com (ipperf.com [206.225.36.162]) by hub.freebsd.org (Postfix) with ESMTP id DBED837B41F for ; Fri, 21 Sep 2001 23:15:36 -0700 (PDT) Received: from ipperformance.com (cs6668163-239.austin.rr.com [66.68.163.239]) by ipperformance.com (8.9.3/8.9.3) with SMTP id BAA14750; Sat, 22 Sep 2001 01:15:34 -0500 (CDT) (envelope-from matt@ipperformance.com) Message-ID: <3BAC2B4E.47E32A07@ipperformance.com> Date: Sat, 22 Sep 2001 01:10:22 -0500 From: Matt Finlay X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: Mario Sergio Fujikawa Ferreira Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: bug in shell `` expansion code? References: <20010922011302.A44620@exxodus.fedaykin.here> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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' > i do not believe this is a bug... it is the way the bash shell executes commands. this is what is happening: first TDF gets set to "echo a && echo b", when you get to the for statement... `${TDF}` causes "echo a && echo b"(TDF) to be executed. however instead of executing the way you are intending it actually executes echo "a && echo b"... this value get stored back into TDF. so that is why you are getting the output i:a i:&& i:echo i:b > > 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message