Linux Know-How provides a collection of introductory texts on often needed Linux skills. |
Home Bash Guide for Beginners The Bash environment Variables Creating Variables | |||
See also: Exporting Variables, Script Recycling with Variables, Array variables | |||
Search the VIAS Library | Index | |||
Creating VariablesVariables are case sensitive and capitalized by default. Giving local variables a lowercase name is a convention which is sometimes applied. However, you are free to use the names you want or to mix cases. Variables can also contain digits, but a name starting with a digit is not allowed:
To set a variable in the shell, use VARNAME="value" Putting spaces around the equal sign will cause errors. It is a good habit to quote content strings when assigning values to variables: this will reduce the chance that you make errors. Some examples using upper and lower cases, numbers and spaces:
|
|||
Home Bash Guide for Beginners The Bash environment Variables Creating Variables |