Search⌘ K

Exploring Environment and Shell Variables

Explore the concepts of environment and shell variables in the command-line interface. Understand how environment variables act as global settings accessible to programs, while shell variables are local to the current shell. Learn commands like env and set to view and manage these variables, helping you customize and control your shell environment effectively.

We'll cover the following...

The two types of variables are environment variables and shell variables. Environment variables are defined in the current shell session and are available to any programs executed. Environment variables often control how programs work. For example, we might set a LANG environment variable that other programs can use to determine the language a program should use to communicate with us. Shell variables are similar, except they’re not available to programs and subprocesses. We can think of environment variables as global variables and shell variables as local ones.

Environment variables

The env command ...