Env Variable

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2022 Nov 30 18:15
Editor
Edited
Edited
2025 Oct 15 15:28
Refs
Refs

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.environ wraps C's environ array 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
 
 
 
 
 

Recommendations