execline: accessing LASTEXITCODE environment variable

From: John Vogel <jvogel4_at_stny.rr.com>
Date: Tue, 19 Aug 2014 22:46:42 -0400


A script I'm working on needs access to the exit code of the last foregrounded command.
I thought I had the idea with something like this:

foreground { exit 122 }

This just prints a blank line. What part of the concept am I missing here?
The documentation seems clear enough, but perhaps I'm being obtuse.
At one point I wondered if LASTEXITCODE was getting set, but after reading
through foreground.c, el_execsequence.c, pathexe_r_name.c, and env_merge.c,
it seems to me that it is being added to the env.

Thanks in advance for any help or clarification.
Received on Wed Aug 20 2014 - 02:46:42 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC