Thursday, April 14, 2016

Linux Tip of the Day -- Environment variables, bash script execution in the context of your command-line window

Linux Tip of the Day --  Environment variables, bash script execution in the context of your command-line window


I had to remind myself about this as I worked on Unix/Linux platform a long time ago and having been in Microsoft shops for many years did not help either :)


If you want your environment variables (being set up by another script) to be properly set up in the context of the window where you are running the script, you have to run the script with a dot and a space in front of it as shown in the screenshots below.


Screenshot of vim editor showing you the content of setup.sh script:











Executing the script in bash window and then verifying if an environment variable is set up:













Almir M.

#Linux #bash #scripts #environmentvariables #programming #code #coding

No comments:

Post a Comment