Search⌘ K

Scope: Environment Variables

Explore the concept of variable scopes in Bash, focusing on environment variables that exist in the global scope. Understand how parent and child processes share these variables and learn to declare and manage environment variables using export and env commands. This lesson provides the foundation needed to control Unix settings and customize application environments in Bash.

We'll cover the following...

Environment variables

Any software system has scopes that group variables. A scope is a part of a program or system where the variable name remains associated with its value. There, we can convert the variable name to its address. Outside the scope, the same name can point to another variable.

A scope is global if it spreads to the whole system. Let’s suppose that the variable called filename is in the global scope. Then, we can access it by its name from any part of the system.

Bash keeps all its internal variables in the global scope. They are called environment variables. This means that all internal variables are environment variables. We can declare our variables in the ...

Global variable