export is bash shell BUILTINS commands, which means it is part of the shell. It marks an environment variables to be exported to child-processes.
Export is defined in POSIX as The shell shall give the export attribute to the variables corresponding to the specified names, which shall cause them to be in the environment of subsequently executed commands. If the name of a variable is followed by = word, then the value of that variable shall be set to the word.
In simple terms, environment variables are set when you open a new shell session. at any time if you change any of the variable values, the shell has no way of picking that change. The export command, on the other hand, provides the ability to update the current shell session about the change you made to the exported variable. You don’t have to wait until new shell session to use the value of the variable you changed.
Syntax :
export [-f] [-n] [name[=value] ...] or export -p
Options of export command
1. Without any argument : To view all the exported variables.
EXAMPLE :

2. -p : To view all exported variables on current shell.
SYNTAX :
$ export -p
EXAMPLE :

3. -f: It must be used if the names refer to functions. If -f is not used, the export will assume the names are variables.
SYNTAX :
$ export -f function_name
EXAMPLE : To export shell function:

Note: Bash command is used for showing that in the child shell, the shell function got exported.
4. name[=value]: You can assign value before exporting using the following syntax.
SYNTAX :
$ export name[=value]
EXAMPLE : To set vim as a text editor

Note: No output will be seen on screen, to see exported variable grep from exported ones is used.
5. -n: Named variables (or functions, with -f) will no longer be exported.
SYNTAX :
$ export -n variable_name
EXAMPLE :

Note: No output will be seen on screen, to see exported variable grep from exported ones is used.
Recommended Posts:
- Difference between node.js require and ES6 import and export
- Node.js | Export Module
- ES6 | Import and Export
- What is export default in JavaScript ?
- 'IPCS' command in Linux with examples
- select command in Linux with examples
- Sed Command in Linux/Unix with examples
- ZIP command in Linux with examples
- SORT command in Linux/Unix with examples
- Cat command in Linux with examples
- Head command in Linux with examples
- Tail command in Linux with examples
- wc command in Linux with examples
- tar command in Linux with examples
- atrm command in Linux with examples
- bc command in Linux with examples
- AWK command in Unix/Linux with examples
- tr command in Unix/Linux with examples
- mv command in Linux with examples
- Paste command in Linux with examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

