I have a script that contains a couple of variables that need to be set as an environment variable
The list of variables change constantly and modifying it on my end
If you are looking to export only variables with a common prefix, e.g.:
BAZ_FOO="FOOFOO" BAZ_BAR="BARBAR"
You could simply do this:
. foo.sh variable_list=() variable_list=( $(set -o posix ; set |\ grep "BAZ_" |\ cut -d= -f1) ) for variable in "${variable_list[@]}" do export "$variable" done