Variables and Arguments



There is NO whitespace before or after =. $name="Aamnah" will work but the preferred syntax is not including $ sign when you are defining a variable. You should use the $ sign when you are calling the variable and NOT when you’re defining it.

Referencing variables:

echo $name
echo ${name}

${name} is preferred syntax.


Arguments are keywords that are passed in the command line when executing the bash script/command.

./ foo bar

$0, $1, $2 etc..

$0 is the name of the script, $1 is the first argument, $2 is the second argument and so on.