Introduction
You use variables to store information and access their values easily in your script. Accessing variables with $var or ${var} lets you use the stored value wherever you need it.
When you want to print a stored value in your script.
When you need to combine a variable with other text or characters.
When you want to pass a variable's value as input to a command.
When you want to check or compare the value stored in a variable.
When you want to use variables inside strings or commands safely.