Export Command Assignment Help

Assignment Help: >> Shell Programming - Export Command

The export command

Whenever a variable is created, it is through definition a local or shell variable that means in which it is available for use by the shell and not for any UNIX applications. They should be made global if these variables are used inside UNIX applications. This is complete by explicitly telling the shell to export the variables to all the programs. By using the export command the variables are exported.

Syntax

export  variablename

In the syntax variablename is the name of the variable to be exported. Let consider the following

Here a local variable Z is assigned a value of 100.  After that, another process starts. The new procedure does not know about the variable Z, that is assigned in its parent shell.

# Z=100

# echo $Z

100

# sh

# echo $Z

# exit

The variable Z can be made global so in which it is available to all the processes as display in the subsequent example

# export           Z

# sh

# echo $Z

100

# Z=200

# echo $Z

200

# exit

# echo $Z

100

Here the value of Z is available to all the subprocesses. The local variable Z precedes the global variable Z if another value is assigned to Z inside the subprocess.

Note: Local variables are available only in during the lifetime of the procedure. They get destroyed with the process. A Global variable are available by the shell session. Whenever the local and the global variable have the similar name, the local variable gets the precedence during execution. only   the variables that have been exported It   lists   out   all   the   exported   variables if an export command is used   without   any   argument,  if   you   are   in   a   sub   shell.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd