[Toybox] Would someone please explain what bash is doing here?
Chet Ramey
chet.ramey at case.edu
Mon May 4 06:39:38 PDT 2020
On 5/2/20 4:01 PM, Rob Landley wrote:
> Why does the export flag on $_ toggle?
It does three different things. It's initially exported if bash inherits it
from the environment at startup; after that it does its thing.
"_ At shell startup, set to the absolute pathname used to invoke
the shell or shell script being executed as passed in the envi-
ronment or argument list. Subsequently, expands to the last ar-
gument to the previous simple command executed in the fore-
ground, after expansion. Also set to the full pathname used to
invoke each command executed and placed in the environment ex-
ported to that command. When checking mail, this parameter
holds the name of the mail file currently being checked."
We picked that up from ksh.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet at case.edu http://tiswww.cwru.edu/~chet/
More information about the Toybox
mailing list