A variable is a character string to which we assign a value. The value assigned could be a number, text, filename, device, or any other type of data.
A variable is nothing more than a pointer to the actual data. We are going to use variables so much in our scripts that it will be unusual for us not to use them.
In this module we are always going to specify a variable in uppercase, for example, UPPERCASE. Using uppercase variable names is not recommended in the real world of shell programming, though, because these uppercase variables may step on system environment variables, which are also in uppercase.
Uppercase variables are used in this book to emphasize the variables and to make them stand out in the code. When you write your own shell scripts or modify the scripts in this book, make the variables lowercase text.
To assign a variable to point to data, we use
as the assignment syntax.
To access the data that the variable, UPPERCASE, is pointing to, we must add a dollar sign, $, as a prefix. for example,
$UPPERCASE. To view the data assigned to the variable, we use echo $UPPERCASE, print $UPPERCASE for variables, or cat $UPPERCASE, if the variable is pointing to a file, as a command structure.