I currently have a bash script that loops through all .env
files, these files are nested in subdirectories, and I want to source each env file (making them seen under printenv command), how do I go about it?
Currently, I have this script
#!/bin/bash
for i in $(find . -type f -iname '.env'); do
echo $i
done
Which outputs:
./packages/database/.env
./packages/api/.env
./packages/email/.env
./apps/starter/.env
This does not work:
for i in $(find . -type f -iname '.env'); do
source $i
done