I used @chepner answer to make archlinux environment variable (PATH) from .env file. Here is my working code for bash. File: ~/.bashrc
FROMENV=''
while IFS="=" read -r key value; do
case "$key" in
'#'*) ;;
*)
echo "Key: $key"
echo "Value: $value"
FROMENV+=":$value"
esac
done < .env
echo "$FROMENV"
PATH=$PATH$FROMENV
After checking, just comment out the echo. # echo "$FROMENV"
For reference my .env file (both in same dir)
NODEJS=/opt/node-v22.11.0-linux-x64/bin
GO=/home/sud/go/bin
PNPM=/home/sud/.local/share/pnpm