Question: How can I set variables to be used in scripts as well? They don't have to be global / system-wide, just the current session is sufficient. But for some reason they seem gone even if I run a script right from my current terminal.

Example:

```bash
foo=bar
echo "$foo"

```

output: `bar`

However if test.sh contains `echo "$foo"` and I do:

```
foo=bar
./test.sh

```

The output is empty. How do I set a scope for temporary variables with a terminal session that remains valid when executing scripts from that same session?

Answer: 
`export foo=bar` will set the global variable $foo to bar. You can also use `foo=bar ./test.sh` as a single command to set foo to bar for test.sh.
You can run the assignment and echo test script in the same shell. 

```
root@ijaz-HP-EliteBook-8560p:~# export foo=bar
root@ijaz-HP-EliteBook-8560p:~# cat test.sh 
   #!/bin/bash
   echo "$foo"
root@ijaz-HP-EliteBook-8560p:~# ./test.sh 
bar

```

this is just one way of doing it.