跨Shell的 .env 文件加载器。生成符合 POSIX 标准的脚本,可在 bash、zsh、dash、ash 中安全加载 .env 文件中的环境变量。用法...
Generates and validates POSIX-compatible .env loading scripts that work consistently across bash, zsh, dash, and ash.
source .env behaves differently across shells:
"value" → includes the quotes)source only assigns, does not export — child processes can't see the variablesThis causes silent failures in deployment when .env files contain quoted values or special characters.
Run the bundled script or use the template:
bash
bash ~/.openclaw/skills/env-loader/scripts/generate-loader.sh /path/to/project
This creates load-env.sh in the target directory.
bash
# Instead of: source .env
# Use:
. ./load-env.sh .env
bash
bash ~/.openclaw/skills/env-loader/scripts/validate-env.sh /path/to/.env
Checks for common issues: unquoted special characters, inline comments, non-POSIX variable names.
source or eval the .env file directly[A-Za-z_][A-Za-z0-9_]* as variable namesSee references/env-pitfalls.md for a detailed catalog of shell-specific .env parsing pitfalls.