sophiakoulen / minishell

A simplified bash-like shell, with pipes, redirections and variable expansion.
3 stars 1 forks source link

What is the _ environment variable? #121

Open sophiakoulen opened 1 year ago

znichola commented 1 year ago

$_ (dollar underscore) is another special bash parameter and used to reference the absolute file name of the shell or bash script which is being executed as specified in the argument list. This bash parameter is also used to hold the name of mail file while checking emails.

also it gets weird: if the _ variable was in the environment that bash received, then bash leaves it untouched. https://unix.stackexchange.com/questions/280453/understand-the-meaning-of

znichola commented 1 year ago

did we fix this? it always seems to be set, or is that zsh setting it before launching minishell?

sophiakoulen commented 1 year ago

I noticed in bash the _ variable appears in env but not in export.