Open ezrizhu opened 8 months ago
Which side is the real env and which side is inside try?
Fixing $PWD
and $OLDPWD
is easy. Fixing $_
is trickier:
: mgreenbe@hippogriff:~/try [configure-install] ; echo $_
bash
: mgreenbe@hippogriff:~/try [configure-install] ; _=flash
: mgreenbe@hippogriff:~/try [configure-install] ; echo $_
: mgreenbe@hippogriff:~/try [configure-install] ; _=flash bash -c 'echo hi $_'
hi /usr/bin/bash
Bash won't let you set $_
, even in a local-assignment We might be able to trick it using env
, as in /usr/bin/env _="$_" ...
:
: mgreenbe@hippogriff:~/try [configure-install] ; env _=flash bash -c 'echo hi $_'
hi flash