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.
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install env-loader - After installation, invoke the skill by name or use
/env-loader - Provide required inputs per the skill's parameter spec and get structured output
What is 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... It is an AI Agent Skill for Claude Code / OpenClaw, with 90 downloads so far.
How do I install Env Loader?
Run "/install env-loader" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Env Loader free?
Yes, Env Loader is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Env Loader support?
Env Loader is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Env Loader?
It is built and maintained by wuhaichao87 (@wuhaichao87); the current version is v1.0.0.