Different Programming Tools
Choosing the right programming tool for the job
Variables are named storage that can hold values. The shell expands a variable when the variable's name occurs after a dollar sign ($), replacing the dollar sign and variable name with the contents of the variable. This is called variable expansion, or substitution, or occasionally replacement or even interpolation. Of these terms, expansion is used most often in documentation,
but substitution is probably the clearest. Variables are assigned using an equals sign (=) with no spaces around it:
$ echo hello, $name
Unlike most other programming languages, the shell uses different syntax when referring to a variable than when assigning a value to it. Variable names start with a letter or underscore, followed by zero or more letters, numbers, and underscores. Some shell programmers use all capitalized names for variables by convention. In this course, I use all capitalized names only for environment variables or special predefined shell variables (such as $IF,).Do not use mixed case; it works, but it is not idiomatic for the shell. If a variable has not been set, it expands to an empty string; there is no warning (usually) for trying to use an unset variable, which can make it hard to detect simple typos. Variables in shell are always strings; the shell does not distinguish between strings, integers, or other data types. The shell is generally considered a typeless language.