Displaying global variables –> “printenv” or “env” Displaying local variables –> “set”
Set a local variable :
Local vars only available in the current shell.
Set a global variable :
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