Environment Variable .env
A simple global string dictionary passed from parent process to child process upon invocation.
Storage method
- Kernel: Stored as null-terminated strings on the stack at execution time.
- Bash: Managed with a hash map stack structure, passed to children only when
exported.
- glibc: Array structure managed with
putenv,getenv(O(n) access).
- Python:
os.environwraps C'senvironarray but synchronization is not complete.
Regulation
- Names cannot contain
=.
- POSIX reserves uppercase variable names for standard utilities, but lowercase names are allowed for application developers. In other words, lowercase names are perfectly fine.
- Single variable maximum 128 KiB, total environment including arguments 2 MiB.
Env Variable Managers
Environment variables are a legacy mess: Let's dive deep into them
Programming languages have rapidly evolved in recent years. But in software development, the new often meets the old, and the scaffolding that OS gives for running new processes hasn’t changed much since Unix. If you need to parametrize your application at runtime by passing a few ad-hoc variables (without special files or a custom solution involving IPC or networking), you’re doomed to a pretty awkward, outdated interface:
https://allvpv.org/haotic-journey-through-envvars/


Seonglae Cho