Re: Should this be this way?

2013-02-26 Thread Roman Rakus
On 02/26/2013 02:03 AM, Linda Walsh wrote: My login shell is /bin/bash (i.e. not /bin/sh); SHELL=/bin/bash as well. Typing 'which bash' gives /bin/bash, and whence bash: bash is /bin/bash. which is not always correct. Use type builtin. I had the foll0wing script which acts differently based on

Re: Should this be this way?

2013-02-26 Thread Pierre Gaston
On Tue, Feb 26, 2013 at 11:22 AM, Roman Rakus wrote: > On 02/26/2013 02:03 AM, Linda Walsh wrote: >> >> My login shell is /bin/bash (i.e. not /bin/sh); SHELL=/bin/bash as well. >> Typing 'which bash' gives /bin/bash, and whence bash: bash is /bin/bash. > > which is not always correct. Use type bui

Re: Should this be this way?

2013-02-26 Thread Chet Ramey
On 2/26/13 12:41 AM, Linda Walsh wrote: > It isn't using the current value of SHELL as my shell nor the value > of my login shell. It uses $0 (or, rather, the basename of $0), which is initialized from the parent shell's argv[0]. What is $0 set to? > > It is forcing interpretation

Re: Should this be this way?

2013-02-26 Thread Linda Walsh
Chet Ramey wrote: > On 2/26/13 12:41 AM, Linda Walsh wrote: > >> It isn't using the current value of SHELL as my shell nor the value >> of my login shell. > > It uses $0 (or, rather, the basename of $0), which is initialized from > the parent shell's argv[0]. What is $0 set to? "-bash"

Re: Should this be this way?

2013-02-26 Thread Greg Wooledge
POSIX specifies the behavior of a shell. This tells Chet how he has to make Bash behave (with some leeway). There are all kinds of silly little details and ambiguities that Chet has to worry about. However, YOU as a shell script writer do not have to worry about all that crap. All you have to d

Re: Should this be this way?

2013-02-26 Thread Linda Walsh
Greg Wooledge wrote: > POSIX specifies the behavior of a shell. This tells Chet how he has to > make Bash behave (with some leeway). There are all kinds of silly little > details and ambiguities that Chet has to worry about. > > However, YOU as a shell script writer do not have to worry about

Re: Should this be this way?

2013-02-26 Thread Greg Wooledge
On Tue, Feb 26, 2013 at 01:27:35PM -0800, Linda Walsh wrote: > Except it isn't a script -- it's input that came from > the terminal, that got repetitively edited using vi mode, until it got > saved in a file so it could continue to be edited, and stay on the screen > while executing it in the

Re: Should this be this way?

2013-02-26 Thread Chet Ramey
On 2/26/13 3:39 PM, Linda Walsh wrote: > > > Chet Ramey wrote: >> On 2/26/13 12:41 AM, Linda Walsh wrote: >> >>> It isn't using the current value of SHELL as my shell nor the value >>> of my login shell. None of this is relevant, see below. > #if 1 <-

Re: More fun with IFS

2013-02-26 Thread Dan Douglas
On Sunday, February 24, 2013 10:26:52 PM Thorsten Glaser wrote: > Dan Douglas dixit: > > >Zsh and pdkshes produce: > > > >one:::two:three:::four > > > >For all of the above, which I think is wrong for the last 4. ksh93 > >produces: > > Why is it incorrect? This test was intended to demonstrate e