Re: Execution of subsequent commands after a command crashes.

Félix Hauri via Bug reports for the GNU Bourne Again SHell <[email protected]>
Newsgroups gmane.comp.shells.bash.bugs
Message-ID <[email protected]>
> You missed a subshell test:

$ test_crash() { local a=$((009+1)) ;}; cnt=0 rmsg=(success failed)

$ ((cnt+=1)); test_crash                   ;echo case $cnt ${rmsg[$?<1?0:1]}
bash: 009: value too great for base (error token is "009")

$ ((cnt+=1)); ( test_crash )               ;echo case $cnt ${rmsg[$?<1?0:1]}
bash: 009: value too great for base (error token is "009")
case 2 failed

$ ((cnt+=1)); ( test_crash ;: )            ;echo case $cnt ${rmsg[$?<1?0:1]}
bash: 009: value too great for base (error token is "009")
case 3 failed

$ ((cnt+=1)); ( (test_crash) ;: )          ;echo case $cnt ${rmsg[$?<1?0:1]}
bash: 009: value too great for base (error token is "009")
case 4 success

-- 
 Félix Hauri  -  <[email protected]>  -  http://www.f-hauri.ch
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.