By the way, you can omit the
export
command. Also, the quotes are not really necessary here because the value does not contain spaces or other special characters.
A simple assignment like
USB=da0
creates a shell variable that can be used throughout the script. That's sufficient most of the time.
The
export
command does the same, but additionally it exports the variable to the process environment, so it is inherited by other commands called from your shell script. For example, when you call
awk(1), your awk code can use the variable with the predefined
ENVIRON
array.
One
IMPORTANT thing to note is that the environment can be seen by unrelated processes (possibly even by other users, unless your security settings prevent that). Just type
ps -auxwwe
to see what I mean. For that reason, you should
never export variables that might contain sensitive data. Every exported variable should be considered “public”. Therefore, if in doubt, do
not use
export
. Only use it when you're certain that it is needed.