And why is an export needed? Where is it exporting to?
And why is an export needed? Where is it exporting to?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Exported variables are passed on to new processes invoked.
Try setting
A=1, then invoking a new shell by entering “bash”, thenecho $A– an empty line.Do the same, but then
export A=1, invoke a new shell, thenecho $A– voila!edit on the technical side, and looking at your question, B=1 doesn’t actually set an environment variable. To get the real environment of your shell (in linux), try
which differs from the output of
export. And as a sidenote, this question touches on the internals of bash and its environment handling.