20 lines
369 B
Bash
20 lines
369 B
Bash
#!/bin/bash
|
|
|
|
# Check if the .env file exists
|
|
if [ ! -f .env ]; then
|
|
echo ".env file not found!"
|
|
exit 1
|
|
fi
|
|
|
|
# Read the .env file line by line
|
|
while IFS='=' read -r key value; do
|
|
# Skip empty lines or comments
|
|
if [[ -z "$key" || "$key" =~ ^# ]]; then
|
|
continue
|
|
fi
|
|
|
|
# Export the variable
|
|
echo "Setting $key as $value"
|
|
export "$key=$value"
|
|
done < .env
|