You can directly eval it:
eval "$(grep -P '^\s*\w+=' config.sh)" #quotes needed if you want the full content of the file (including newlines etc.) Sourcing is essentially the same as:
eval "$(cat file)" Note, however, that people could be executing all kinz of codez at the right side of the equal sign:
a=$(evil_code_here) b=`evil_code_here` c="something" evil_code_here #etc. You need a better filter.