Timeline for Why is the exit status always 0 at the start of a script?
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 9, 2016 at 17:28 | vote | accept | Nathan Long | ||
| Mar 9, 2016 at 17:28 | answer | added | Bratchley | timeline score: 2 | |
| Mar 9, 2016 at 17:24 | answer | added | user156990 | timeline score: 1 | |
| Mar 9, 2016 at 17:12 | comment | added | Bratchley |
That is exactly why. There are different bash processes executing each line of code and $? isn't shared between the processes.
|
|
| Mar 9, 2016 at 17:09 | comment | added | Nathan Long | I'm guessing the answer is "$? is local to the current shell process and the script is a subprocess" | |
| Mar 9, 2016 at 17:07 | history | asked | Nathan Long | CC BY-SA 3.0 |