Linux Know-How provides a collection of introductory texts on often needed Linux skills. |
Home Bash Guide for Beginners More on variables General assignment of values | ||
See also: Using the declare built-in | ||
Search the VIAS Library | Index | ||
General assignment of valuesAs we already saw, Bash understands many different kinds of variables or parameters. Thus far, we haven't bothered much with what kind of variables we assigned, so our variables could hold any value that we assigned to them. A simple command line example demonstrates this:
There are cases when you want to avoid this kind of behavior, for instance when handling telephone and other numbers. Apart from integers and variables, you may also want to specify a variable that is a constant. This is often done at the beginning of a script, when the value of the constant is declared. After that, there are only references to the constant variable name, so that when the constant needs to be changed, it only has to be done once. A variable may also be a series of variables of any type, a so-called array of variables (VAR0VAR1, VAR2, ... VARN).
|
||
Home Bash Guide for Beginners More on variables General assignment of values |