757 reputation
724
bio website
location
age
visits member for 3 years
seen Jan 25 at 7:12

51m
awarded  Nice Question
4h
awarded  Yearling
Jan
11
accepted Save exit code for later
Jan
11
comment Save exit code for later
So with your update I would have to initialize last_error_code to zero and then return at the end so I would have non-zero exit code if any command threw an error? It is a cool trick, but for my two line hack script, I think I prefer @mikeserv 's answer.
Jan
11
comment Save exit code for later
Ah I agree it's better than my original. But it still feels unsatisfactory that I have to explicitly store the exit code to a variable. Is there no way to 'push' an exit code and 'pop' it again later?
Jan
11
asked Save exit code for later
Sep
27
awarded  Notable Question
Sep
20
awarded  Popular Question
Sep
7
awarded  Nice Question
Aug
15
awarded  Popular Question
Aug
6
awarded  Notable Question
Jul
29
awarded  Popular Question
Jul
2
awarded  Curious
Jun
9
awarded  Caucus
Jun
1
awarded  Popular Question
Apr
5
accepted what does `sshfs -oworkaround=rename` do?
Apr
5
asked what does `sshfs -oworkaround=rename` do?
Mar
28
awarded  Popular Question
Jan
29
awarded  Yearling
Jan
24
asked arecord to record what is playing on speakers