Re: typeset -p on an empty integer variable is an error. (plus -v test w/ array elements)

2013-01-14 Thread Greg Wooledge
On Sun, Jan 13, 2013 at 03:31:24AM +0100, John Kearney wrote: > set -o errexit > test_func() { > [ ! -d test ] && echo test2 > } > > echo test3 > test_func > echo test4 > > now so long as test doesn't exist in the cwd it should errexit. > at least it did for me just now. Cannot reproduce. i

"$(echo "x'" '{1,2}')" performs brace expansion, even though it should not

2013-01-14 Thread Marco Elver
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/local

Re: "$(echo "x'" '{1,2}')" performs brace expansion, even though it should not

2013-01-14 Thread Chet Ramey
On 1/14/13 8:57 AM, Marco Elver wrote: > Machine Type: x86_64-unknown-linux-gnu > > Bash Version: 4.2 > Patch Level: 42 > Release Status: release > > Description: > If a double-quoted command substitution command contains a > double-quoted string containing a single-quote, followed b

Re: typeset -p on an empty integer variable is an error. (plus -v test w/ array elements)

2013-01-14 Thread John Kearney
Am 14.01.2013 14:33, schrieb Greg Wooledge: > On Sun, Jan 13, 2013 at 03:31:24AM +0100, John Kearney wrote: >> set -o errexit >> test_func() { >> [ ! -d test ] && echo test2 >> } >> >> echo test3 >> test_func >> echo test4 >> >> now so long as test doesn't exist in the cwd it should errexit. >>

Re: typeset -p on an empty integer variable is an error. (plus -v test w/ array elements)

2013-01-14 Thread Greg Wooledge
On Mon, Jan 14, 2013 at 08:08:53PM +0100, John Kearney wrote: > this should exit. > #!/bin/bash > > set -e > f() { test -d nosuchdir && echo no dir; } > echo testings > f > echo survived OK, cool. That gives me more ammunition to use in the war against set -e. ==

Re: typeset -p on an empty integer variable is an error. (plus -v test w/ array elements)

2013-01-14 Thread John Kearney
Am 14.01.2013 20:25, schrieb Greg Wooledge: > On Mon, Jan 14, 2013 at 08:08:53PM +0100, John Kearney wrote: >> this should exit. >> #!/bin/bash >> >> set -e >> f() { test -d nosuchdir && echo no dir; } >> echo testings >> f >> echo survived > OK, cool. That gives me more ammunition to use in the w

Re: "$(echo "x'" '{1, 2}')" performs brace expansion, even though it should not

2013-01-14 Thread Dan Douglas
On Monday, January 14, 2013 01:57:14 PM Marco Elver wrote: > echo "$(echo "x'" '{1,2}')" This was fixed in git a while back, but not backported to 4.2. I believe this: 8/21 command.h - W_NOBRACE: new word flag that

Re: typeset -p on an empty integer variable is an error. (plus -v test w/ array elements)

2013-01-14 Thread Chet Ramey
On 1/14/13 2:57 PM, John Kearney wrote: > I have no idea why errexit exists I doubt it was for lazy people > thought. its more work to use it. I had someone tell me one with a straight (electronic) face that -e exists `to allow "make" to work as expected' since historical make invokes sh -ce to r

Re: "$(echo "x'" '{1, 2}')" performs brace expansion, even though it should not

2013-01-14 Thread Chet Ramey
On 1/14/13 11:00 AM, Dan Douglas wrote: > On Monday, January 14, 2013 01:57:14 PM Marco Elver wrote: >> echo "$(echo "x'" '{1,2}')" > > This was fixed in git a while back, but not backported to 4.2. I believe this: > > 8/21 >

Re: typeset -p on an empty integer variable is an error. (plus -v test w/ array elements)

2013-01-14 Thread Ken Irving
On Mon, Jan 14, 2013 at 08:57:41PM +0100, John Kearney wrote: > ... > btw > || return $? > > isn't actually error checking its error propagation. Also btw, I think you can omit the $? in this case; from bash(1): return [n] ... If n is omitted, the return status is that of th

Re: typeset -p on an empty integer variable is an error. (plus -v test w/ array elements)

2013-01-14 Thread John Kearney
Am 14.01.2013 22:09, schrieb Ken Irving: > On Mon, Jan 14, 2013 at 08:57:41PM +0100, John Kearney wrote: >> ... >> btw >> || return $? >> >> isn't actually error checking its error propagation. > Also btw, I think you can omit the $? in this case; from bash(1): > > return [n] > ... >

question of command cd's option [-e]

2013-01-14 Thread MaShimiao
Configuration Information : Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OS TYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' -DCONF_VENDOR ='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHA

about one feature in V4.2 against V4.1

2013-01-14 Thread douxin
Hello: i am from China and i am working on investigating the difference between bash V4.2 and V4.1 according to official log there is a new feature description "Posix mode shells no longer exit if a variable assignment error occurs with an assignment preceding a command that is n