Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14623 > unrolled thread
| Started by | Eduardo A. Bustamante López <dualbus@gmail.com> |
|---|---|
| First post | 2018-09-21 08:17 -0700 |
| Last post | 2018-09-21 08:17 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Special parameter ? Eduardo A. Bustamante López <dualbus@gmail.com> - 2018-09-21 08:17 -0700
| From | Eduardo A. Bustamante López <dualbus@gmail.com> |
|---|---|
| Date | 2018-09-21 08:17 -0700 |
| Subject | Re: Special parameter ? |
| Message-ID | <mailman.1091.1537543061.1284.bug-bash@gnu.org> |
On Fri, Sep 21, 2018 at 04:17:11PM +0200, Enrique Soriano wrote: > > You're seeing the status from the creation of the background job (which is > > always 0), not from its completion. > > Ah, I see. > > Anyway, the behavior is not coherent with the manual page: in this > case, $? has the status from the creation of the background job, > that's not "the status of the most recently executed foreground > pipeline". The thing that creates the background job IS a foreground pipeline. It's a foreground pipeline that creates a background job, if that makes sense. dualbus@ubuntu:~$ cat t.sh (exit 2) (exit 3) & pid=$! echo $? wait "$pid" echo $? dualbus@ubuntu:~$ bash t.sh 0 3 I recommend to store the value of $? in a variable if you plan on using it afterwards, since it's extremely easy to end up overriding its value.
Back to top | Article view | gnu.bash.bug
csiph-web