Re: Shell execution ( [was] Re: Value of $? lost in the beginning of a function.)

2009-07-20 Thread Lowell Gilbert
Glen Barber glen.j.bar...@gmail.com writes: Possibly off-topic... 2009/7/19 Glen Barber glen.j.bar...@gmail.com: 2009/7/19 Romain Tartière rom...@blogreen.org: Hi Glen, On Sun, Jul 19, 2009 at 04:32:28PM -0400, Glen Barber wrote: % sh foo.sh % zsh foo.sh % bash foo.sh What happens

Re: Shell execution ( [was] Re: Value of $? lost in the beginning of a function.)

2009-07-20 Thread Glen Barber
Hi, Lowell On Mon, Jul 20, 2009 at 7:02 AM, Lowell Gilbertfreebsd-stable-lo...@be-well.ilk.org wrote: Glen Barber glen.j.bar...@gmail.com writes: Possibly off-topic... 2009/7/19 Glen Barber glen.j.bar...@gmail.com: 2009/7/19 Romain Tartière rom...@blogreen.org: Hi Glen, On Sun, Jul 19,

Re: Shell execution ( [was] Re: Value of $? lost in the beginning of a function.)

2009-07-20 Thread Lowell Gilbert
Glen Barber glen.j.bar...@gmail.com writes: Hi, Lowell On Mon, Jul 20, 2009 at 7:02 AM, Lowell Gilbertfreebsd-stable-lo...@be-well.ilk.org wrote: Glen Barber glen.j.bar...@gmail.com writes: Possibly off-topic... 2009/7/19 Glen Barber glen.j.bar...@gmail.com: 2009/7/19 Romain Tartière

Re: Shell execution ( [was] Re: Value of $? lost in the beginning of a function.)

2009-07-20 Thread Glen Barber
On Mon, Jul 20, 2009 at 1:56 PM, Lowell Gilbertfreebsd-stable-lo...@be-well.ilk.org wrote: Glen Barber glen.j.bar...@gmail.com writes: The shell specified in the #! first line is only consulted if you run it as ./foo.sh.  Otherwise, it's input to the shell that you started, and the line is

Re: Shell execution ( [was] Re: Value of $? lost in the beginning of a function.)

2009-07-20 Thread Glen Barber
On Mon, Jul 20, 2009 at 3:12 PM, Doug Bartondo...@freebsd.org wrote: Glen Barber wrote: Possibly off-topic... It's very off topic for -stable. If you want to follow up on this, please do so in -hackers. I meant to say in the last line: '#!/bin/sh' would override the 'zsh' shell. Can

Re: Shell execution ( [was] Re: Value of $? lost in the beginning of a function.)

2009-07-20 Thread Doug Barton
Glen Barber wrote: Possibly off-topic... It's very off topic for -stable. If you want to follow up on this, please do so in -hackers. I meant to say in the last line: '#!/bin/sh' would override the 'zsh' shell. Can someone enlighten me if I am wrong about this? It's trivial to create an

Value of $? lost in the beginning of a function.

2009-07-19 Thread Romain Tartière
Hi! Simple test case: 8-- #!/bin/sh foo() { echo \$?=$? \$1=$1 } false foo $? 8-- % sh foo.sh $?=0 $1=1 % zsh foo.sh $?=1 $1=1 % bash foo.sh $?=1 $1=1 As you can see, the value of $? is « lost » when FreeBSD sh enters a function. Is this

Re: Value of $? lost in the beginning of a function.

2009-07-19 Thread Glen Barber
2009/7/19 Romain Tartière rom...@blogreen.org: Hi! Simple test case: 8-- #!/bin/sh foo() {  echo \$?=$? \$1=$1 } false foo $? 8-- % sh foo.sh $?=0 $1=1 % zsh foo.sh $?=1 $1=1 % bash foo.sh $?=1 $1=1 As you can see, the value of

Re: Value of $? lost in the beginning of a function.

2009-07-19 Thread Romain Tartière
Hi Glen, On Sun, Jul 19, 2009 at 04:32:28PM -0400, Glen Barber wrote: % sh foo.sh % zsh foo.sh % bash foo.sh What happens if you replace '#!/bin/sh' with '#!/usr/local/bin/zsh' ? This is not related to my problem since I am not running the script using ./foo.sh but directly using the

Re: Value of $? lost in the beginning of a function.

2009-07-19 Thread Jilles Tjoelker
On Sun, Jul 19, 2009 at 10:26:38PM +0200, Romain Tartière wrote: Hi! Simple test case: 8-- #!/bin/sh foo() { echo \$?=$? \$1=$1 } false foo $? 8-- % sh foo.sh $?=0 $1=1 % zsh foo.sh $?=1 $1=1 % bash foo.sh $?=1 $1=1 As you

Re: Value of $? lost in the beginning of a function.

2009-07-19 Thread Glen Barber
2009/7/19 Romain Tartière rom...@blogreen.org: Hi Glen, On Sun, Jul 19, 2009 at 04:32:28PM -0400, Glen Barber wrote: % sh foo.sh % zsh foo.sh % bash foo.sh What happens if you replace '#!/bin/sh' with '#!/usr/local/bin/zsh' ? This is not related to my problem since I am not running the

Re: Value of $? lost in the beginning of a function.

2009-07-19 Thread Romain Tartière
On Sun, Jul 19, 2009 at 10:47:55PM +0200, Jilles Tjoelker wrote: This has been fixed in 8.x: Cool, thanks! -- Romain Tartière rom...@blogreen.orghttp://romain.blogreen.org/ pgp: 8DAB A124 0DA4 7024 F82A E748 D8E9 A33F FF56 FF43 (ID: 0xFF56FF43) (plain text =non-HTML= PGP/GPG

Re: Value of $? lost in the beginning of a function.

2009-07-19 Thread Oliver Pinter
do you plan to MFC this fix? On 7/19/09, Romain Tartière rom...@blogreen.org wrote: On Sun, Jul 19, 2009 at 10:47:55PM +0200, Jilles Tjoelker wrote: This has been fixed in 8.x: Cool, thanks! -- Romain Tartière rom...@blogreen.orghttp://romain.blogreen.org/ pgp: 8DAB A124 0DA4 7024

Shell execution ( [was] Re: Value of $? lost in the beginning of a function.)

2009-07-19 Thread Glen Barber
Possibly off-topic... 2009/7/19 Glen Barber glen.j.bar...@gmail.com: 2009/7/19 Romain Tartière rom...@blogreen.org: Hi Glen, On Sun, Jul 19, 2009 at 04:32:28PM -0400, Glen Barber wrote: % sh foo.sh % zsh foo.sh % bash foo.sh What happens if you replace '#!/bin/sh' with

Re: Shell execution ( [was] Re: Value of $? lost in the beginning of a function.)

2009-07-19 Thread Mark Andrews
In message 4ad871310907191717g1ed90be7y92250f2addc38...@mail.gmail.com, Glen Barber writes: Possibly off-topic... 2009/7/19 Glen Barber glen.j.bar...@gmail.com: 2009/7/19 Romain Tarti=E8re rom...@blogreen.org: Hi Glen, On Sun, Jul 19, 2009 at 04:32:28PM -0400, Glen Barber wrote:

Re: Shell execution ( [was] Re: Value of $? lost in the beginning of a function.)

2009-07-19 Thread Glen Barber
On Sun, Jul 19, 2009 at 9:02 PM, Mark Andrewsma...@isc.org wrote: In message 4ad871310907191717g1ed90be7y92250f2addc38...@mail.gmail.com, Glen Barber writes: Possibly off-topic... 2009/7/19 Glen Barber glen.j.bar...@gmail.com: 2009/7/19 Romain Tarti=E8re rom...@blogreen.org: Hi Glen,

Re: Shell execution ( [was] Re: Value of $? lost in the beginning of a function.)

2009-07-19 Thread Ian Smith
On Mon, 20 Jul 2009, Mark Andrews wrote: In message 4ad871310907191717g1ed90be7y92250f2addc38...@mail.gmail.com, Glen Barber writes: Possibly off-topic... [..] My understanding was this: If you specify 'sh foo.sh' at the shell, the script will be run in a /bin/sh shell,