Env Loader
/install env-loader
Env Loader
Generates and validates POSIX-compatible .env loading scripts that work consistently across bash, zsh, dash, and ash.
Problem It Solves
source .env behaves differently across shells:
- zsh: Strips quotes from values correctly
- bash/dash: Preserves quotes as part of the value (
"value"→ includes the quotes) - All shells:
sourceonly assigns, does notexport— child processes can't see the variables
This causes silent failures in deployment when .env files contain quoted values or special characters.
Usage
Generate the Loader Script
Run the bundled script or use the template:
bash ~/.openclaw/skills/env-loader/scripts/generate-loader.sh /path/to/project
This creates load-env.sh in the target directory.
Use in Deployment Scripts
# Instead of: source .env
# Use:
. ./load-env.sh .env
Validate an Existing .env File
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.
Key Design Principles
- POSIX-only syntax — no bashisms, no zsh-isms, works in dash/ash
- Manual key=value parsing — never
sourceorevalthe .env file directly - Explicit quote stripping — removes surrounding single or double quotes consistently
- Key validation — only allows
[A-Za-z_][A-Za-z0-9_]*as variable names - Explicit export — every parsed variable is exported for child processes
References
See references/env-pitfalls.md for a detailed catalog of shell-specific .env parsing pitfalls.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install env-loader - 安装完成后,直接呼叫该 Skill 的名称或使用
/env-loader触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Env Loader 是什么?
Shell-agnostic .env file loader. Generates a POSIX-compatible script to safely load environment variables from .env files across bash, zsh, dash, and ash. Us... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 90 次。
如何安装 Env Loader?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install env-loader」即可一键安装,无需额外配置。
Env Loader 是免费的吗?
是的,Env Loader 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Env Loader 支持哪些平台?
Env Loader 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Env Loader?
由 wuhaichao87(@wuhaichao87)开发并维护,当前版本 v1.0.0。