ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
in what sense do you want these accessible? you can always do something like using Data:umper to print out any data structures to a file to read later... if you want a more temporary method on only a couple of variables, try exporting them to bash
Since you can only export to subsequent shells, here are some things to look at:
1. Source the script instead of having a separate shell
execute it. i.e. . scriptname
2. Have your script run the command that needs the environment
3. Save the value of the variable to a file and then read the file in the previous script using: var=`cat filename`
This would be cumbersome if multiple people were running the script because the filename would need to be unique for a user.