Variables used in Bash Scripts.

These are always treated as strings.

Declaration

Variables are declared with

var_name=value

where there can be no space since Bash will otherwise interpret the variable name as a command.

Reference

Values of variables are referenced with

$var_name

or

${var_name}

Examples

Declaration

user="alice"

Reference

echo "Hello, $user"   # prints: Hello, alice

Declaration and Reference

export PATH="/usr/local/bin:$PATH"