10. Your Environment

When you log on to your system, whether it’s a shiny new Mac OS X Terminal app, a clean Linux install, or a Unix server in the back office, you’re effectively given your own copy of the shell program. This login shell maintains what’s known as your environment—a configuration that is distinct from other users on the system. This environment is maintained from the moment you log on until the moment you log off. In this chapter you’ll learn about the shell environment and you’ll see how it relates to writing and running programs.

Local Variables

Type the following program called vartest into your computer:

$ cat vartest echo :$x: $

vartest consists of a single echo command that displays the value of the variable x surrounded ...

Get Shell Programming in Unix, Linux and OS X, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.