The results of commands can be written to a file or saved in variables. Because variables are saved in memory, they tend to be faster to examine than files. Bash doesn't put an upper limit on the size of a variable: They are large enough to contain anything you will ever need to hold.
Using variables is essential to shell script programming. This chapter is an in-depth look at variables and how they are used in the shell, from basic variables to expanding variables with the
Variables are declared using the Bash
declare command. To declare a variable named
COST, use this:
$ declare COST
Use the built-in
typeset statement for compatibility with the Korn shell. If you are using Bash, use
declare instead. ...