2 added 19 characters in body
source | link

$_ does not seem to be an environmental variable in bash, bash only appears to export it into a child process' environment. Inside bash itself it seems to be locala normal shell variable. Note however this is not the case when the first command is executed:

$ bash -c 'export -p | grep _='
declare -x _="/bin/bash"

Afterwards however it shows up as a localnormal variable:

$ bash -c ':; declare -p | grep _='
declare -- BASH_EXECUTION_STRING=":; declare -p | grep _="
declare -- _=":

Not this is not the case in dash:

$ dash -c 'export -p | grep _='
export _='/bin/dash'
$ dash -c ':; export -p | grep _='
export _='/bin/dash'

Although here it only seems to take on its proper role in interactive mode:

$ dash
$ :
$ export -p | grep _=
export _=':'

$_ does not seem to be an environmental variable in bash, bash only appears to export it into a child process' environment. Inside bash itself it seems to be local variable. Note however this is not the case when the first command is executed:

$ bash -c 'export -p | grep _='
declare -x _="/bin/bash"

Afterwards however it shows up as a local:

$ bash -c ':; declare -p | grep _='
declare -- BASH_EXECUTION_STRING=":; declare -p | grep _="
declare -- _=":

Not this is not the case in dash:

$ dash -c 'export -p | grep _='
export _='/bin/dash'
$ dash -c ':; export -p | grep _='
export _='/bin/dash'

Although here it only seems to take on its proper role in interactive mode:

$ dash
$ :
$ export -p | grep _=
export _=':'

$_ does not seem to be an environmental variable in bash, bash only appears to export it into a child process' environment. Inside bash itself it seems to be a normal shell variable. Note however this is not the case when the first command is executed:

$ bash -c 'export -p | grep _='
declare -x _="/bin/bash"

Afterwards however it shows up as a normal variable:

$ bash -c ':; declare -p | grep _='
declare -- BASH_EXECUTION_STRING=":; declare -p | grep _="
declare -- _=":

Not this is not the case in dash:

$ dash -c 'export -p | grep _='
export _='/bin/dash'
$ dash -c ':; export -p | grep _='
export _='/bin/dash'

Although here it only seems to take on its proper role in interactive mode:

$ dash
$ :
$ export -p | grep _=
export _=':'
1
source | link

$_ does not seem to be an environmental variable in bash, bash only appears to export it into a child process' environment. Inside bash itself it seems to be local variable. Note however this is not the case when the first command is executed:

$ bash -c 'export -p | grep _='
declare -x _="/bin/bash"

Afterwards however it shows up as a local:

$ bash -c ':; declare -p | grep _='
declare -- BASH_EXECUTION_STRING=":; declare -p | grep _="
declare -- _=":

Not this is not the case in dash:

$ dash -c 'export -p | grep _='
export _='/bin/dash'
$ dash -c ':; export -p | grep _='
export _='/bin/dash'

Although here it only seems to take on its proper role in interactive mode:

$ dash
$ :
$ export -p | grep _=
export _=':'