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?
Share
You simply source the script with the assignments in your shell script like so:
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.)