Chapter 14. Environment and shell variables

To make your time in the shell more productive, you have shell variables at your disposal. Shell variables are names that hold values. A value can be a path name, a filename, or maybe a number, the shell treats any assignment as a string of text.

There are two types of variables, local and environment. Strictly speaking there are four, but the other two are read-only and are considered special variables used in passing parameters to shell scripts.

In this chapter we will cover:

  • shell variables;

  • environment variables;

  • variable substitution;

  • exporting variables;

  • special variables;

  • passing information to scripts; and

  • using positional parameters on system commands.

Get Linux and Unix Shell Programming 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.