Source
From Linuxintro
Revision as of 11:04, 20 April 2014 by imported>ThorstenStaerk (Created page with "source is a command to execute a script and set environment variables from it. Normally when a script is run it gets its own environment and can only modify va...")
source is a command to execute a script and set environment variables from it. Normally when a script is run it gets its own environment and can only modify variables within that. With the command source the modifications get applied to the context of the calling program. Example:
- hello.sh
export hello=world
./hello.sh echo $hello
source hello.sh echo $hello world