Local and Non-Local Variables
- A variable that is created in the shell, by default exists only in the shell, not in scripts that you run.
- When you export a variable in the shell, it is available to a script that you run, but changes made in the script do not pass back to the shell.
- The contents of the exported variable will also be available to scripts that are called by that script.
The dot (.) Command
The “.” command can be used to run a script in the current shell.
- When it is used, the PID observed for the script is the same as for the shell that it is running in.
- All shell variables, whether exported or not, are available.
- If shell variables are changed in the script, the changes are seen in the shell as well.