export builtin
The builtin that marks a shell variable so child processes receive a copy of it in their environment.
In more detail
After export city, every program the shell starts can read city, but a child that changes it only changes its own copy. VAR=value command sets a variable in the environment of that one command only.
Examples
export city=Londonbash show.shRelated terms
- environment variable — A named setting such as PORT=8000 that a program reads from its surroundings when it starts.
- shell variable — A named value stored in the current shell, set with name=value and read back with $name.
- child process — A process started by another process, its parent, from which it inherits a copy of the environment and current directory.
- env — A command that prints the environment, or runs another program with a changed environment or found through PATH.
Taught in
- Shell Variables, The Environment And export — Bash Scripting & Command Line Automation
- set -e, set -u And pipefail: Promises And Traps — Bash Scripting & Command Line Automation