O'Reilly logo

Linux and Unix Shell Programming by David Tansley

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 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.

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