Re: Referencing empty array with "set -u" active throws error

2010-12-20 Thread jens . schmidt35
> -u Treat unset variables as an error when substituting. > > I think the behaviour is consistent with the documentation. The question is rather when to consider a variable set or unset. For me, an empty string (or empty commadline) is as set or as unset as an empty array. But I don't get an "

Re: cd with multiple arguments?

2010-12-20 Thread Marc Herbert
Le 17/12/2010 20:57, Bob Proulx a écrit : > CGI scripts are not normally setuid but are running as the web > server process owner You wish... > Instead they stem from a script running unverified user provided > input. [...] It is a problem, and a big one, but completely different from > having a

Re: Referencing empty array with "set -u" active throws error

2010-12-20 Thread Jan Schampera
jens.schmid...@arcor.de wrote: -u Treat unset variables as an error when substituting. I think the behaviour is consistent with the documentation. The question is rather when to consider a variable set or unset. I'm not sure about the intended meaning here, but I don't consiter $@ as a var

Re: Referencing empty array with "set -u" active throws error

2010-12-20 Thread Chet Ramey
On 12/20/10 3:52 AM, jens.schmid...@arcor.de wrote: >> -u Treat unset variables as an error when substituting. >> >> I think the behaviour is consistent with the documentation. > > The question is rather when to consider a variable set or unset. > > For me, an empty string (or empty commadline)

Re: Referencing empty array with "set -u" active throws error

2010-12-20 Thread Chet Ramey
> > For me, an empty string (or empty commadline) is as set or as > > unset as an empty array. But I don't get an "unbound error" when > > accessing an empty string (or empty commandline), and I get one > > when accessing an empty array. > > As the man page says: > > A parameter is set if it has

exit status question

2010-12-20 Thread Curtis Doty
Not exactly sure if this is a bug. But I don't understand why only the first time running ((i++)) returns an error exit status. Here's my script: #! /bin/bash echo $BASH_VERSION ${BASH_VERSINFO[5]} set -x #set -e i=0 ((i++)) echo $? ((i++)) echo $? And here's what the output looks like: 4.1.7

Re: exit status question

2010-12-20 Thread Eric Blake
On 12/20/2010 11:25 AM, Curtis Doty wrote: > Not exactly sure if this is a bug. But I don't understand why only the > first time running ((i++)) returns an error exit status. Because it follows the same semantics as 'expr', where status 1 is reserved for a successful run with value 0, and status 2

Re: exit status question

2010-12-20 Thread Curtis Doty
11:30am Eric Blake said: On 12/20/2010 11:25 AM, Curtis Doty wrote: Not exactly sure if this is a bug. But I don't understand why only the first time running ((i++)) returns an error exit status. Because it follows the same semantics as 'expr', where status 1 is reserved for a successful run

Re: exit status question

2010-12-20 Thread Greg Wooledge
On Mon, Dec 20, 2010 at 10:38:11AM -0800, Curtis Doty wrote: > The workaround of using ((++i)) seems to work. What if i starts at -1? > Sounds like this is a FAQ. I have a page at http://mywiki.wooledge.org/BashFAQ/105 in fact.