loadenv() {
case "$-" in
*a*) source ./.env ;;
*) set -a; source ./.env; set +a ;;
esac
}
Although I have yet to see a long shellscript utilise `set -a` globally :) loadenv() {
set -a
source ./.env
set +a
} sh -ac '. ./.env; ./prog'
Also if you use the `.` builtin it's a good idea to specify the path with a slash in it, so that `.` doesn't search $PATH first. ip -br -c addr
to get a very readable and colorful table-like output.