Export command in Linux














































Export command in Linux



Export is part of the shell that marks an environment variables to be exported to child-processes. 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. The user does not have to wait until a new shell session to use the value of the variable you changed.

Syntax :


1. Without any argument: To view all the exported variables.
EXAMPLE :


2. -p : To view all exported variables on current shell

SYNTAX :


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 :



EXAMPLE :



4. name[=value]: You can assign value before exporting using the following syntax.

SYNTAX :



EXAMPLE:



5. -n: Named variables (or functions, with -f) will no longer be exported.

SYNTAX :



EXAMPLE:



Comments