IT 3110 : Advanced System Administration

Variables


Variables

Remember, they are containers that hold strings and numbers.

    a=3
    name=tom

Though, traditionally vars are written in ALL CAPS.


Variables


Scripting


Variables

Use the full syntax for a variable reference, which includes not just the dollar sign, but also braces around the variable name:

    somescript /tmp/rep${FN}port.txt

Export Variables

Export variables that you want to pass on to other scripts:

   export SOMEVAR

Using parameters in a shell script


Variables

Default values: