Linux Bash Shell Export Tutorial with Examples

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-bash-shell-export-tutorial-with-examples/
PINTEREST
PINTEREST
INSTAGRAM

Bash is a shell and a simple programming shell too. There are a lot variables built in or externally specified. If a variable is specified externally making this variable system wide available is a problem. Export command makes variables available system wide by propagating to the sub shells. Exported variable would not be available to the parent processes. Which means previously spawned or created process will not get exported variable. Syntax of export is like below there is two way to export some variable.

Directly Export

We can export newly created variable with the following syntax by using export keyword.

In this case we export all ready defined variable to the sub shells.

Directly Export
Directly Export

Export After Defining

We can use following syntax in order to export all ready defined bash variable.

In this model variable is just defined before exported. After variable definition variable exported to the system wide.

Export After Defining
Export After Defining

List Exported Variables

It can be listed exported varibles with -p parameter.

List Exported Variables
List Exported Variables

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-bash-shell-export-tutorial-with-examples/
PINTEREST
PINTEREST
INSTAGRAM
LEARN MORE  Crash Linux System With A Bash Fork Bomb