*export* all variables from key=value file to shell *export* all variables from key=value file to shell shell shell

*export* all variables from key=value file to shell


Run set -a before sourcing the file. This marks all new and modified variables that follow for export automatically.

set -asource site.confset +a  # Require export again, if desired.

The problem you observed is that the pipe executes the export in a subshell. You can avoid that simply by using input redirection instead of a pipe.

while read assignment; do  export "$assignment"done < site.conf

This won't work, however, if (unlikely though it is) you have multiple assignments on one line, such as

EMAIL="dev@example.com" FULLNAME="Master Yedi"