What is the difference between a shell variable that is
exported and the one that is not exported?
Answers were Sorted based on User's Feedback
Answer / madhavi
the major difference between the shell variable that is
exported and not is variable exported using export command
is global to all shell,where as the other shell variables
are local to their respective shells.
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / seshadri sethi
The Shell variable which is exported would available to all
the programs outside the Shell also. And the shell variable
which is not exported, would available for that shell or for
the shell program only, in which the variable is declared.
Export LANG=C
will make the variable LANG the global variable, put it into
the global environment. All other processes can use it.
LANG=C
will change the value only in the current script.
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / shimpi
Exported variable is like GLOBAL variable which can be used
across teh scripts and UNIX servers.
Whereas Unexported variable can be the used within the
defined script itself.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / narendrasairam
What that makes the difference is its Access Scope.
An exported variable is available across the scrips unlike
an unexported one which is local to the script.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / tony
By default, Shells will only keep all variables to the Shell in which they run. This is good, since it assumes variables are not needed outside of a given script. In most cases, that is correct. But, if you have a script that you want to use to set Shell variables, it must be exported in some way. Alternative ways to export variables, is to call a script with "source" or just with a dot and a whitespace.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / guest
Chile process will inharite the variable and its value v/s
will not inharit
Is This Answer Correct ? | 1 Yes | 2 No |
What are different types of shell?
How can I set the default rwx permission to all users on every file which is created in the current shell?
What are scripts in psychology?
What are the disadvantages of shell scripting?
write a program to display all the files from the current directory which are created in particular month
What is the command to find out users on the system?
Shifting positional parameter in Linux fedora core ? Hi I have written following shell script for display value of positional. But in 11th and 12 field will display without shifting command. May I know is it advance of Linux of programming code error? #!/usr/bin/bash echo "Bellow is the out of ps command" echo "`ps`" echo "The passing Parameter i.e output of \$1,2... value is:==> $11 " echo "Total number of passed argument \$# is:==> $#" echo "Passed argument names (\$*) are:==>$*" echo "This script PID(\$$) is :=>$$" echo "The name of executing script(\$0) is :==>$0" echo "The Parent ID of this script(\$PPID) is:==>$PPID" And my input to this script is ./scriptname arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10 arg11 arg12 Output Is Bellow is the out of ps command PID TTY TIME CMD 2892 pts/0 00:00:00 bash 3172 pts/0 00:00:00 positional_para 3173 pts/0 00:00:00 ps The passing Parameter i.e output of $1,2... value is:==> arg11 Total number of passed argument $# is:==> 13 Passed argument names ($*) are:==>arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 arg10 arg11 arg12 arg13 This script PID($$) is :=>3172 The name of executing script($0) is :==>./positional_parameter The Parent ID of this script($PPID) is:==>2892 After the ps output please see the next line I.e $11 value comes out without shifting the parameter. How is it give me my friends
Which shell is the best?
How do I debug a shell script?
How to replace following lines, catch (DAOException e) { objLogger.error(this.getClass () + "addUpdateIssues() " + e); throw new BOException(5122); } catch (BOException e) { objLogger.error(this.getClass () + "addUpdateIssues() " + e); throw e; } catch (Exception e) { objLogger.error(this.getClass () + "addUpdateIssues() " + e); throw new BOException(5122); } Needs to be changed in to, catch (DAOException e) { AppException.handleException (null, null, e, null, null, null, "BOException", this.getClass() + "addUpdateIssues() ", null, null, null, null, null, null, null, null, 5122); } catch (BOException e) { AppException.handleException (null, null, null, e, null, null, "BOException", this.getClass() + "addUpdateIssues() ", null, null, null, null, null, null, null, null, 0); } catch (Exception e) { AppException.handleException (null, null, null, null, null, e, "BOException", this.getClass() + "addUpdateIssues() ", null, null, null, null, null, null, null, null, 5122); }
How to set an array in linux?
What is Linux language details