Variables

In algebra, you learned that you can use letters to stand for unknown quantities in algebraic equations, and that these letters are called variables. In programming, the concept is pretty much the same, although programming variables can hold strings (strings of characters) as well as numbers.

You work with two types of variables in shell programming: shell variables and environment variables. The primary difference is that environment variables are available to other scripts or programs that you call from inside your shell program, whereas shell variables are available only to the script itself.

Variables in shell programming are loosely typed; they do not have to be declared or typeset before they can be used, whereas in other programming ...

Get FreeBSD6 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.