Environment variables


Displaying global variables –> “printenv” or “env” Displaying local variables –> “set”

Set a local variable : VARNAME="value"

Local vars only available in the current shell.

Set a global variable : export VARNAME="value"

Useful special bash variables : $? Exit status of the most recently executed foreground pipeline. $$ Process ID of the shell. $! Process ID of the most recently executed background command. $0 Expands to the name of the shell or shell script.

Many more here

Thanks for reading this post!

If you found an issue in this article, you can create an issue on Github.

If you have a comment or question, please drop me a line below!