June 2025
Beginner to intermediate
1180 pages
37h 48m
English
The functionality of bash and that of many other Linux programs is controlled by the state of variables. bash variables can only store strings. The assignment of variables is done by the assignment operator =. The easiest way to display the contents of a variable is to use echo, prefixing the variable name with a $ character:
user$ var='abc'user$ echo $varabc
Strange rules apply to the handling of variables in bash. For reading variables, the name must be preceded by a dollar character. However, this does not apply to assignments. The preceding listing is therefore correct!
Also note that you do not specify a space between the variable name and the = operator when making assignments. var = abc is syntactically incorrect and ...
Read now
Unlock full access