Reputation: 1220
I have set some variables in my shell, because I need them all the time. How can I make a script, that I call on the same shell that has variables set access the variables that are defined in the shell, without passing them explicitely as parameters?
Upvotes: 1
Views: 213
Reputation: 72619
You simply source the script with the assignments in your shell script like so:
. /path/to/settings # Dot, blank, name of file.
This will execute the contents of settings in the current shell (as opposed to starting a subshell, where assignments are lost after the subshell ends.)
Upvotes: 1