O'Reilly logo

Practical Linux by Bill Ball, John Ray, Michael Turner, M. Drew Streib

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

Using Shell Variables

Variables are temporary placeholders for information, either numbers or sequences of characters (called strings). The system (that is, the shell) has a number of useful predefined variables, such as the user name, home directory, and system name. Using the env command generates a listing of all persistent environment variables (meaning that they don't stop existing when the current command or script ends, instead they exist for your Linux login environment as a whole) defined in your shell. Listing 21.3 is the output generated by the env command on my machine. This will vary somewhat from machine to machine, of course.

Code Listing 21.3. Sample Output Listing of the env Command
 [jwalter@jansmachine samples_22]$ env USERNAME= ...

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