O'Reilly logo

Expert Shell Scripting by Ron Peters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 7Indirect Reference Variables

It is possible to set a normal (direct) variable in three ways:

  • Directly, by assigning it a value
  • By storing the output of a command
  • By storing the results of some type of calculation

In all of these cases, although you might not know a variable's value in advance of any given point, you do know the name of the variable that is to receive the value.

For example, AGE=36 is a direct variable assignment. The value of 36 might change at a later stage and it may also have some calculation applied to it, but the variable name AGE will not change.

In some cases, however, you may need the ability to generate variable names on the fly. You may not know the number or names of variables you are going to need at the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required