TLDR Dev · ARTICLES & TUTORIALS
ENVIRONMENT VARIABLES ARE A LEGACY MESS: LET'S DIVE DEEP INTO THEM
Summary from the TLDR Dev newsletter
Environment variables are a flat, global dictionary of strings passed from parent to child processes through the `execve` system call. When a new program is launched, the kernel places these variables on the stack as null-terminated strings, which the program then copies into its own data structure (like a hashmap in Bash or an array in glibc). While the Linux kernel and glibc are liberal about the format of environment variables, it's generally recommended to use uppercase letters, digits, and underscores for names, and UTF-8 encoding for values to avoid potential issues.