Variables

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

There are two types of variables you will deal with in shell programming: shell variables and environment variables. The primary difference is that environment variables will be available to other scripts or programs that you call from inside your shell program and shell variables will be 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. All variables ...

Get FreeBSD® 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.