schon/scripts/Unix/export-environment-file.sh
Egor fureunoir Gorbunov e7ba7dde0f Features: 1) Update reboot script to improve readability in service status messages; 2) Specify application name as "eVibes" in final confirmation message;
Fixes: 1) Standardize spacing in spinner commands for consistency; 2) Correct alignment of service lifecycle commands;

Extra: Adjust wording for better clarity and uniformity in reboot.sh script.
2025-06-16 14:09:37 +03:00

26 lines
635 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
env_file='.env'
if [[ ! -f $env_file ]]; then
echo "Error: $env_file not found in the current directory." >&2
return 1 2>/dev/null || exit 1
fi
while IFS= read -r line || [[ -n $line ]]; do
line="${line#"${line%%[![:space:]]*}"}"
line="${line%"${line##*[![:space:]]}"}"
[[ -z $line || $line == \#* ]] && continue
[[ $line != *"="* ]] && continue
key="${line%%=*}"
value="${line#*=}"
if [[ ( $value == \"*\" && $value == *\" ) || ( $value == \'*\' && $value == *\' ) ]]; then
value="${value:1:-1}"
fi
export "$key"="$value"
echo "Exported $key"
done < "$env_file"