I have a .env file with those vars:
REACT_APP_API_URL=https://my-enpoint.com/api
REACT_APP_APP_URL=https://my-app.com
ESLINT_NO_DEV_ERRORS=true
REACT_APP_PUSHER_APP_KEY=d83519e4-6017-41f4-b8b2-6093f6480914
...etc
I would like to check if any of the variables are missing and print info about missing value in specified variable.
I've tried to read a variables from file in loop but I cannont access to them in loop. Manually its possible, by getting variable one by one. But I want to do it automatically. My code:
VARIABLES=("REACT_APP_URL" "REACT_APP_API_URL" "ESLINT_NO_DEV_ERRORS" "REACT_APP_PUSHER_APP_KEY")
source .env
for i in "${!VARIABLES[@]}"; do
env -S "$(cat .env)" sh -c 'echo '${VARIABLES[$i]}"'
done
I have zero exp in bash but I need to make some basic automation in my project