Bash Environment Variables

| No Comments | No TrackBacks
  #2 (permalink)  
Old 02-Aug-2007, 06:38
ken_yap
Guest
 
Posts: n/a
Default

Environment variables can only be set in the current process and exported downwards to child processes, not upwards to parent processes. Your shell script is a subprocess of the interactive shell. When your shell script ends, so does the scope of the environment variables. If you want a short cut to set the variables, then it has to be run in the current shell. Which means you have to source the script rather than run it as a child. The syntax is:

. script

That's a dot in the first column. It means read this file and run it as if I had typed the lines to this interactive shell.

No TrackBacks

TrackBack URL: http://writch.com/mt/mt-tb.cgi/496

Leave a comment

February 2009

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28

About this Entry

This page contains a single entry by writch published on February 23, 2009 5:39 PM.

Top 15 Terminal Commands for Hidden Mac OS X Settings was the previous entry in this blog.

Securing Linux Tutorial is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Categories

OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.21-en