This is an old revision of the document!
Table of Contents
Bash Variables
Local Variables
```bash foo=one
printvalue() { local foo=two
echo $foo }
# This will print one
to the console.
echo $foo
# This will print two
to the console.
printvalue
# This will print one
to the console.
echo $foo
```
Environment Variables
One feature we will use for Scope is the system that exists in all Unix systems. For example, when we call a program in a script, all environment variables are copied into the scope of that program. In short, the variables we define in the called script can only be accessed if they are environment variables.
```bash # create a new variable and set it: # → This is a normal variable, not an environment variable! test_variable=“Hello World.”
# Let's make it visible to all sub-processes by converting it to an environment variable: export test_variable ```
Taken from UCH Wiki. ===== NOTLAR =====