Similar to other programming languages, variable in Bash are character string to which we assign a value.
Defining variables
To define a variable use the following syntax
Be awarded here you can’t put spaces around the assignment operator name = value
, because Bash uses spaces as a delimiter to separate command arguments.
Accessing variables
To access the value stored in a variable, prefix its name with the dollar sign ($)
Without a dollar sign the Bash will treat some special variable names as a Bash command.