RE: Possible bug with BASH V4: The "$!"

2013-04-12 Thread Lenga, Yair
Chet, Thanks for the detailed feedback. I double check the documentation (man, changelog) issues, those seems to be local problems with our system (for some strange reason, the man pages were mirrored from RH4 image). One last comment about the "double subshell" case: > ( echo "$!") & > ( echo

Bash4: Problem retrieving "$?" when running with "-e"

2013-04-12 Thread Lenga, Yair
Good Morning, I've encountered another interesting change in behavior between Bash3 and Bash4. I hope that you can help me: The core question is how to retrieve the status of a command, when running with '-e' For production critical jobs, we run the script in '-e', to ensure that all steps ar

Re: Bash4: Problem retrieving "$?" when running with "-e"

2013-04-12 Thread Greg Wooledge
On Fri, Apr 12, 2013 at 11:44:49AM +, Lenga, Yair wrote: > The core question is how to retrieve the status of a command, when running > with '-e' http://mywiki.wooledge.org/BashFAQ/105

Re: Bash4: Problem retrieving "$?" when running with "-e"

2013-04-12 Thread John Kearney
Am 12.04.2013 13:44, schrieb Lenga, Yair: > Good Morning, > > I've encountered another interesting change in behavior between Bash3 and > Bash4. I hope that you can help me: > > The core question is how to retrieve the status of a command, when running > with '-e' > > For production critical jobs

Re: Bash4: Problem retrieving "$?" when running with "-e"

2013-04-12 Thread Chet Ramey
On 4/12/13 7:44 AM, Lenga, Yair wrote: > The man page says that '-e' will "exit immediately if a simple command (note > Simple Command::) exits with non-zero status unless ...". > The "simple commands" definition is a "sequence of words separate by blanks > ...". According to this definition, th

RE: Bash4: Problem retrieving "$?" when running with "-e"

2013-04-12 Thread Lenga, Yair
Chet, Sorry again for pulling the wrong Bash 4 doc. Based on the input, I'm assuming that the portable way (bash 3, bash 4 and POSIX) to retrieve $? When running under "-e" is to use the PIPE CMD_STAT=0 ; GET_MAIN_DATA || CMD_STAT=$? If [ "$CMD_STAT" = 11 ] ; then GET_BACKUP_DATA Fi A

Re: Bash4: Problem retrieving "$?" when running with "-e"

2013-04-12 Thread John Kearney
Am 12.04.2013 18:26, schrieb Lenga, Yair: > Chet, > > Sorry again for pulling the wrong Bash 4 doc. > > Based on the input, I'm assuming that the portable way (bash 3, bash 4 and > POSIX) to retrieve $? When running under "-e" is to use the PIPEr > CMD_STAT=0 ; GET_MAIN_DATA || CMD_STAT=$? That i

trap EXIT in piped subshell not triggered during wait

2013-04-12 Thread Ilya Basin
Hi! I've got strange behavior. Here's my script: #!/bin/bash { trap ' echo "in trap EXIT">&2 ' EXIT sleep 4 & echo 'sleep 2'>&2 sleep 2 echo 'wait $!'>&2 wait $! echo 'exit'>&2 exit } | cat If I press