Linux Know-How provides a collection of introductory texts on often needed Linux skills. |
![]() |
Home ![]() ![]() ![]() ![]() |
|||
See also: Exporting Variables, Script Recycling with Variables, Array variables | |||
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
|||
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 ![]() ![]() ![]() ![]() |