What is the difference between a shell variable that is
exported and the one that is not exported?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is mac default shell?

614


What is the difference between bash and shell?

641


What does $0 mean in shell script?

554


What language is bash?

489


What is a beat in a script?

543






How can any user find out all information about a specific user like his default shell, real-life name, default directory, when and how long he has been using the system?

716


What is the crontab?

543


What are the different types of shell scripting?

532


What is sudo command?

550


What is the syntax of "nested if statement" in shell scripting?

629


Write down the syntax of "for " loop

607


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); }

1853


What is difference between bash and shell?

551


What is scripting autism?

700


How to redirect both standard output and standard error to the same location?

629