Fact-checked by Grok 2 weeks ago

Environment variable

An environment variable is a dynamic pair of a name and a value that stores accessible to processes running in an operating system, allowing programs to adapt their behavior without modifying . These variables are inherited by processes from their parent, forming a for passing environmental across the system. Environment variables were first implemented in Version 7 in 1979. In systems, environment variables are defined as null-terminated strings in the format NAME=value and can influence utilities, functions, and applications as specified in standards like . Environment variables serve multiple purposes, including standardizing shell configurations, managing sensitive data such as API keys or database credentials, and enabling consistent application behavior across different deployment environments like development, , and . They promote security by keeping secrets out of hardcoded code and facilitate portability, as the same application can run on various operating systems—such as , Windows, or macOS—by relying on OS-provided variables. Common system-wide variables include PATH, which specifies directories for executable searches; HOME, indicating the user's ; and USER, denoting the current username, all of which are typically set by the operating system upon login. To manage environment variables, users and administrators can set them temporarily in a session using commands like export NAME=value in Unix shells or set NAME=value in Windows Command Prompt, while permanent settings are configured in profile files such as ~/.bashrc for user-specific variables or /etc/environment for system-wide ones on . Programs access these variables through language-specific functions, such as getenv() or os.environ in , retrieving values to configure runtime options like database connections or debug modes. In modern development, tools like .env files or secrets managers further extend their use, loading variables into the for containerized or cloud-based applications while adhering to best practices for secure handling.

Introduction

Definition

An environment variable is a dynamic named value maintained by the operating system that affects the behavior of running processes, providing configurable parameters such as paths, locales, or resource limits to influence program execution without modifying the code itself. These variables are passed to a process at startup via its execution environment, allowing applications to query and utilize them for runtime decisions, such as determining file locations or user preferences. Environment variables follow a key-value pair structure, where the name () is a typically composed of uppercase letters, digits, and underscores—starting with an uppercase letter—and the is an arbitrary that may encode paths, numerical , or other textual . This format enables a standardized way to associate settings with processes, with no inherent limit on the number of variables or their individual lengths, though the aggregate size combined with command-line arguments may be constrained by system resources. In C-language programs, the is presented as an of null-terminated strings (environ), terminated by a , facilitating access through functions like getenv(). A key distinction exists between environment variables and shell variables: the former are inherited by child processes and accessible system-wide at the process level, while shell variables remain local to the invoking shell session unless explicitly exported to become part of the environment. This separation ensures that only intended configurations propagate to subprocesses, preventing unintended leakage of transient shell state. The concept of environment variables originated in early Unix systems during the 1970s, evolving from initial variable mechanisms in shells to a formalized process-level feature by the late decade.

Purpose and History

Environment variables serve several primary purposes in computing systems. They enable the configuration of software behavior by allowing applications to adapt to different runtime conditions without requiring recompilation or code modifications, such as specifying database connection strings or log levels. Additionally, they facilitate the storage of temporary data, the passing of information between parent and child processes during execution, and the definition of system paths, exemplified by the PATH variable which directs the operating system to locations for executable files. The concept of environment variables originated in Unix Version 7, released in 1979, where they were introduced through modifications to the exec system call, enabling processes to inherit a set of key-value pairs from their parents. This innovation built on earlier Unix versions by adding a third argument to exec for passing the environment block, a design that persists in modern Unix-like systems. Environment variables were later adopted in PC DOS 2.0 in 1982, primarily to support batch processing and command scripting in the MS-DOS environment, marking their entry into personal computing operating systems. Their evolution continued with Windows NT in 1993, which integrated environment variables with the Windows Registry for persistent storage and management, distinguishing between system-wide and user-specific variables to enhance configurability in multi-user scenarios. A key advantage of environment variables lies in their role in promoting portability across platforms. By externalizing configuration details into environment-specific variables, software can operate consistently on diverse systems—such as Unix, Windows, or environments—without embedding platform-dependent code, thereby simplifying and deployment. In contemporary , environment variables remain essential for scripting, where they enable dynamic parameterization of scripts and tasks; for application deployment in containerized environments like and , where they manage secrets and settings across , testing, and production stages; and for environment-specific adaptations, such as toggling debug modes or endpoints based on the deployment context.

Design Principles

Core Concepts

Environment variables form the environment of a process, consisting of a collection of key-value pairs that are passed to the process at its startup by the operating system or a . This environment is stored in process-specific structures, such as an of strings or a contiguous block, allowing the process and its code to access these values dynamically during execution. In environments, exporting a refers to the mechanism by which a includes a in its , making it available for by child processes. When a new process is created, it receives a copy of the parent's , enabling configuration and state to propagate without direct passing; only variables included in the parent's are part of this inheritable set, distinguishing them from non-inheritable s. Variables are referenced in commands through expansion and substitution, where the or runtime replaces a (such as $NAME in shells or %NAME% in Windows) with the variable's actual value before executing the command. This process occurs during , ensuring the resolved value is used in the final command line or script execution, and supports nested or conditional expansions for flexible usage. Operating systems impose limits on the total size of the block (combined arguments and variables) and individual variables to manage memory and security. In systems, the total is limited by ARG_MAX (typically 128 KB to 2 MB as of 2024, configurable via parameters). In Windows, pre- versions capped the total at 32 KB; from onward, there is no total size limit, though individual variables are limited to 32,767 characters. These constraints ensure efficient process creation but require careful management of variable counts and lengths.

Inheritance and Scope

Environment variables follow an inheritance model where a child process receives a copy of the parent's environment at creation, remaining independent so modifications in the child do not affect the parent or siblings. For example, in Unix-like systems, this occurs via the fork() system call, and the environment can be passed or replaced during exec() invocation; in Windows, CreateProcess copies the environment block unless specified otherwise. The scope of environment variables is process-local, visible only to the process and its descendants, but inaccessible to siblings or unrelated es. Within a session, exported variables propagate to subprocesses launched from that . For system-wide scope, variables are initialized via OS startup mechanisms, such as scripts or configuration files loaded during authentication. Modifications to environment variables, whether through OS-specific APIs (e.g., setenv() in or SetEnvironmentVariable() in Windows) or builtins, apply only to the current and do not retroactively alter previously created children's environments. This unidirectional inheritance ensures isolation, with changes affecting only future children. The lifetime of environment variables aligns with the process, persisting until exit. For persistence across sessions or reboots, variables are defined in configuration files, such as user profiles or .

Syntax and Manipulation

Unix-like Systems

In systems, environment variables conform to standards, serving as key-value pairs that convey configuration and state information to processes and their children. These variables are integral to the , influencing the behavior of utilities, applications, and the shell itself. Unlike transient shell variables, true environment variables are explicitly exported and inherited across process boundaries, ensuring persistence in execution contexts. Several standard environment variables are commonly predefined in Unix-like systems. The HOME variable specifies the pathname of the user's , used by utilities like to determine the default directory for navigation. The variable (or the POSIX-defined LOGNAME as its equivalent) holds the login name of the current user, aiding in user-specific operations and authentication checks. The variable identifies the pathname of the user's preferred command interpreter, guiding applications that invoke shells. Additionally, the variable indicates the type of the terminal in which the process is running, enabling terminal-dependent features such as cursor control and screen formatting in tools like tput. These variables are literal strings, requiring no shell-style expansion when accessed, and are directly available to processes upon invocation. System-wide defaults for environment variables are typically established through configuration files processed at system startup or login. The /etc/environment file, parsed by the Pluggable Authentication Modules (PAM) framework in many implementations, sets initial variables for all user sessions and non-interactive processes, supporting simple assignments without shell interpretation. For login shells, profile scripts such as /etc/profile or files in /etc/profile.d/ extend these settings, sourcing additional variables during shell initialization to propagate them to interactive environments. Process-specific overrides occur via the execve() system call, which replaces the current process image and passes an explicit array of environment strings (in name=value format) to the new executable, allowing targeted modifications without altering the parent environment. A key distinction in Unix-like systems lies between shell variables and true environment variables. Shell variables are confined to the current shell instance and its non-exported assignments, ceasing to exist upon shell exit. In contrast, exported environment variables—achieved via the command—survive the shell's termination and are automatically inherited by child processes, including those launched via execve(), ensuring consistent access across the process tree. This inheritance model supports modular program design while maintaining security boundaries, as parents cannot directly modify child environments post-fork.

DOS, OS/2, and Windows

In and , environment variables are primarily set during system boot using commands in the and files. The SET command in defines variables that apply to the operating system and its applications, storing them in memory for access by programs. For example, common true environment variables include , which specifies directories for executable files and is typically set to include the system directory like C:\DOS, and , which points to the command interpreter such as C:\COMMAND.COM in or the shell. TEMP is another standard variable, directing temporary file storage to a designated , often set to C:\TEMP by default. These variables are loaded sequentially from first, followed by , ensuring persistence across sessions unless modified. In , SET statements in specifically target applications, while handles user-level settings like extensions. In Windows, environment variables follow a similar structure but are managed through the registry for system-wide persistence, with user-specific overrides possible. System variables are stored in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment registry key, loaded at to establish defaults. Common true variables include , which by default encompasses directories like %SystemRoot%\system32 and %SystemRoot%, enabling executable discovery; , set to %SystemRoot%\system32[cmd.exe](/page/Cmd.exe) as the command interpreter; , pointing to %USERPROFILE%\AppData\Local\Temp for temporary files; and SYSTEMROOT, typically C:\Windows, referencing the main system folder. Variable expansion in , , and Windows uses the direct syntax %VAR%, where the percent signs delimit the variable name for substitution without recursive or delayed processing by default. These variables are inherited by child processes, maintaining consistency in execution environments.

Usage Examples

Basic Operations

Environment variables are typically set for immediate use in a command by prefixing the assignment with the variable name and value, followed by the command that utilizes it, such as VAR=value some_command ${VAR} in shell-based systems. This method exports the variable only to the subprocess running the command, allowing it to reference the value without altering the parent environment. To view all current environment variables, utilities like env or shell builtins such as set can be invoked, displaying a list of variable names paired with their values in a key-value format. These commands provide a snapshot of the environment block accessible to the process. Unsetting an environment variable involves using a dedicated command like unset VAR, which removes the variable from the current environment block. Verification of removal can be done by attempting to retrieve the variable's value, which should return empty or indicate it is undefined. Nested referencing occurs when one environment variable incorporates the value of another during expansion, such as configuring PATH to include ${HOME}/bin:${PATH}, where ${HOME} resolves to the user's home directory path before the full PATH is constructed. This allows dynamic composition of values based on existing variables.

Platform-Specific Cases

In Unix-like systems, such as Linux and macOS, environment variables are manipulated using shell commands like export in Bourne-compatible shells (e.g., Bash). A common real-world application is modifying the PATH variable to include a new directory for executable searches, ensuring that subsequent commands can locate programs in the added path without full qualification. For instance, the command export PATH=$PATH:/new/dir appends /new/dir to the existing PATH, and echo $PATH displays the updated value, such as /usr/local/bin:/usr/bin:/new/dir assuming the prior value. This approach is temporary for the current session unless added to a shell configuration file like .bashrc. On Windows, using the Command Prompt (), the SET command assigns values to environment variables, which can then be referenced in commands or batch scripts. A practical example involves setting a temporary directory for applications that require it, such as SET TEMP=C:\temp, followed by echo %TEMP% to verify the assignment (outputting C:\temp) and dir %TEMP% to list its contents, confirming accessibility for file operations. This setting persists only for the current process and its children unless made permanent via . In and early Windows batch files (.bat), the @echo off directive suppresses command echoing for cleaner output, while SET customizes interactive elements like the command . For example, @echo off followed by SET PROMPT=$P$G restores the default prompt displaying the current drive and path (e.g., C:\>) and can be used within loops to maintain consistent feedback during iterative tasks, such as file processing scripts. This configuration enhances usability in automated sequences without altering the core batch logic. Regarding error handling, referencing an undefined environment variable typically results in an empty string expansion rather than an explicit error, allowing scripts to continue execution gracefully. In systems, echo $UNDEF outputs nothing (blank line), treating the absence as an empty value. Similarly, in Windows and , echo %UNDEF% produces a blank output, though enclosing in delimiters like echo [%UNDEF%] reveals the empty expansion as [], preventing unintended command interpretation while avoiding runtime halts.

True Environment Variables

Unix-like Systems

In Unix-like systems, environment variables conform to standards, serving as key-value pairs that convey configuration and state information to processes and their children. These variables are integral to the , influencing the behavior of utilities, applications, and the itself. Unlike transient shell variables, true environment variables are explicitly exported and inherited across process boundaries, ensuring persistence in execution contexts. Several standard environment variables are commonly predefined in systems. The HOME variable specifies the pathname of the user's , used by utilities like to determine the default for . The USER variable (or the POSIX-defined LOGNAME as its equivalent) holds the login name of the current , aiding in user-specific operations and authentication checks. The SHELL variable identifies the pathname of the user's preferred command interpreter, guiding applications that invoke . Additionally, the TERM variable indicates the type of in which the process is running, enabling terminal-dependent features such as cursor control and screen formatting in tools like tput. These variables are literal strings, requiring no shell-style expansion when accessed, and are directly available to processes upon invocation. System-wide defaults for environment variables are typically established through configuration files processed at system startup or login. The /etc/environment file, parsed by the Pluggable Authentication Modules (PAM) framework in many implementations, sets initial variables for all user sessions and non-interactive processes, supporting simple assignments without shell interpretation. For login shells, profile scripts such as /etc/profile or files in /etc/profile.d/ extend these settings, sourcing additional variables during shell initialization to propagate them to interactive environments. Process-specific overrides occur via the execve() system call, which replaces the current process image and passes an explicit array of environment strings (in name=value format) to the new executable, allowing targeted modifications without altering the parent environment. A key distinction in Unix-like systems lies between shell variables and true environment variables. Shell variables are confined to the current shell instance and its non-exported assignments, ceasing to exist upon shell exit. In contrast, exported environment variables—achieved via the command—survive the shell's termination and are automatically inherited by child processes, including those launched via execve(), ensuring consistent access across the process tree. This inheritance model supports modular program design while maintaining security boundaries, as parents cannot directly modify child environments post-fork.

DOS, OS/2, and Windows

In and , environment variables are primarily set during system boot using commands in the and files. The SET command in defines variables that apply to the operating system and its applications, storing them in memory for access by programs. For example, common true environment variables include , which specifies directories for executable files and is typically set to include the system directory like C:\DOS, and , which points to the command interpreter such as C:\COMMAND.COM in or the shell. TEMP is another standard variable, directing temporary file storage to a designated , often set to C:\TEMP by default. These variables are loaded sequentially from first, followed by , ensuring persistence across sessions unless modified. In , SET statements in specifically target applications, while handles user-level settings like extensions. In Windows, environment variables follow a similar but are managed through the registry for system-wide persistence, with user-specific overrides possible. System variables are stored in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment registry key, loaded at to establish defaults. Common true variables include , which by default encompasses directories like %SystemRoot%\system32 and %SystemRoot%, enabling executable discovery; , set to %SystemRoot%\system32[cmd.exe](/page/Cmd.exe) as the command interpreter; , pointing to %USERPROFILE%\AppData\Local\Temp for temporary files; and SYSTEMROOT, typically C:\Windows, referencing the main system folder. Variable expansion in , , and Windows uses the direct syntax %VAR%, where the percent signs delimit the variable name for substitution without recursive or delayed processing by default. These variables are inherited by child processes, maintaining consistency in execution environments.

Pseudo-Environment Variables

DOS and Windows

In DOS and Windows, pseudo-environment variables serve as dynamic placeholders that the command-line interpreter ( in DOS or in Windows) expands at runtime during command , providing information without being stored as persistent, inheritable values like true environment variables. These variables mimic the syntax of true environment variables (enclosed in percent signs) but generate their content on-the-fly based on system state, such as the current date or the result of a prior command. In DOS, common pseudo-environment variables include %DATE%, which expands to the current system date in the format defined by the DATE command; %TIME%, which provides the current system time in the format set by the TIME command; and %ERRORLEVEL%, which returns the exit code (error level) from the most recently executed or batch command. For example, after running a program that fails, %ERRORLEVEL% might expand to a non-zero value like 1, allowing conditional logic in batch files via commands like IF ERRORLEVEL 1. These are processed by the interpreter and are essential for scripting runtime conditions, though their availability can vary by DOS version, with fuller support in later releases like 6.x. Windows extends these with additional pseudo-variables tailored for batch scripting and dynamic operations. %CD% expands to the current path, %RANDOM% generates a pseudo-random between 0 and 32,767 each time it is referenced, and batch-specific modifiers like %~dp0 provide the drive letter and full path to the containing the executing (e.g., in a script saved as C:\Scripts\test.bat, %~dp0 yields C:\Scripts). Other modifiers, such as %~d0 for the drive of the or %f0 for its full path, follow similar () syntax for parameter expansion. These are particularly useful in scripts for tasks like timestamps or generating unique filenames. A key limitation of pseudo-environment variables in both and Windows is their confinement to the interpreter's command context: they expand only when parsed by the during command execution, and unexpanded forms (e.g., literal "%%") are passed to child executables if not pre-expanded into a true via SET. Consequently, they are not inherited or preserved across boundaries like true environment variables, requiring explicit handling in scripts to propagate values. Command extensions, enabled by default in modern Windows but disableable via /E:OFF, are required for access to many of these (e.g., %%, %RANDOM%), and their behavior may differ in pure environments without extensions.

Other Shells and Systems

In shells such as and Zsh, pseudo-environment variables encompass special s that provide dynamic runtime information without being part of the persistent environment block. For instance, the parameter $? holds the of the most recently executed foreground , allowing scripts to check command outcomes immediately after execution. Similarly, $$ expands to the process ID () of the current instance, useful for or process management within scripts. The character (~), when unquoted at the beginning of a word, undergoes tilde expansion to represent the of the current user, facilitating path shortcuts in commands like cd ~. These features operate analogously in Zsh, where special parameters like $? and $$ are predefined and read-only, ensuring consistent behavior across compatible shells. Unlike true variables, these pseudo-variables are generated on-the-fly by shell builtins or expansion mechanisms during command processing, rather than being stored in the process's environment block passed to child processes. This dynamic computation enables real-time evaluation—such as querying the current or —but means they are not inherited or exportable in the same manner as standard variables. In the (csh) and its variant , equivalent functionality exists with variations; for example, $status captures the of the last command, differing from Bash's $? and highlighting shell-specific syntax. Beyond Unix variants, other systems feature similar constructs. In , automatic variables like $PWD provide the current path, computed dynamically based on the session's location without relying on static storage. In OS/2's command processor (), pseudo-variables like BeginLIBPath and EndLIBPath support library path management, expanded during command interpretation rather than treated as fixed environment entries. Portability challenges arise due to these variations; scripts relying on $? in Bash may fail in csh without adjustment to $status, necessitating conditional checks or standardized alternatives for cross-shell compatibility. Such differences underscore the importance of shell-specific documentation when developing portable automation.

Security and Best Practices

Common Risks

Environment variables pose significant security risks due to their visibility and persistence across processes. Sensitive information, such as API keys or database credentials, stored in environment variables can be exposed through system commands like ps or env, allowing unauthorized users with access to the process list to view them. This visibility extends to other processes on the system, potentially enabling attackers to extract secrets if they compromise a shared user context. Additionally, environment variables persist in process memory dumps or core files generated during crashes, making them recoverable even after process termination and increasing the risk of post-incident data exposure. Injection attacks exploit environment variables by incorporating untrusted input, leading to unintended command execution. For instance, manipulating the PATH variable to include directories containing malicious executables can cause legitimate commands to invoke trojans instead, hijacking execution flow without altering the target binary. Untrusted data in other variables, such as those passed to shell scripts, can enable command injection, where attackers append arbitrary commands that the application executes with elevated privileges. This vulnerability is particularly acute in applications that dynamically construct commands based on environment settings, allowing remote code execution if input validation is absent. Denial-of-service conditions arise from overly long or numerous environment variables that exhaust system resources. Excessive length in variables like PATH can trigger buffer overflows during processing, causing application crashes or halting execution. Large environment blocks consume significant , potentially leading to allocation failures or system-wide slowdowns, especially in resource-constrained environments like containers or embedded systems. Historical incidents highlight these risks in production environments, particularly web servers. In 2014, the Shellshock vulnerability (CVE-2014-6271) allowed attackers to inject and execute code via specially crafted variables in , affecting millions of web servers running scripts and enabling remote command execution. Similarly, the 2021 Codecov supply chain compromise involved attackers modifying a uploader script to exfiltrate variables containing secrets from CI/CD pipelines, impacting over 23,000 organizations and exposing keys used in web applications. More recently, in 2025, CVE-2025-24959 in the ZX JavaScript tool enabled variable injection via the dotenv , allowing arbitrary command execution by injecting unintended variables into process.env. Additionally, CVE-2025-41253 in Spring Cloud Gateway permitted exposure of variables and system properties through Spring Expression Language (SpEL) in application routes, risking leakage of secrets in cloud-native setups. These events underscore how variable mishandling in web server configurations can lead to widespread data breaches and unauthorized access.

Mitigation Strategies

To mitigate risks associated with variables, particularly for sensitive data, one primary strategy is to avoid their use altogether when possible. Instead, store sensitive information such as keys, passwords, or certificates in dedicated files or secrets services. For instance, services like AWS Secrets Manager allow retrieval of secrets at without exposing them as environment variables, reducing the risk of leakage through process listings or inheritance. Similarly, Microsoft's Secret Manager tool in provides a secure mechanism during , ensuring secrets are not persisted in or environment spaces. This approach aligns with broader guidelines that prioritize ephemeral access to secrets over persistent environmental exposure. In pipelines, tools like GitHub Actions support encrypted secrets that are injected only at , further limiting exposure. For cases where environment variables are necessary, techniques are essential to prevent injection or manipulation vulnerabilities. Scripts should validate environment variable contents—such as checking for expected formats or lengths—before use, and always variables when expanding them to avoid word-splitting or globbing issues in commands. For example, in , using double quotes around ${VAR} ensures safe expansion even if the variable contains spaces or special characters. Additionally, limit the scope of exported variables by declaring them locally within functions or scripts using keyword, preventing unintended to subprocesses. The CERT Secure Coding Standard recommends clearing unnecessary environment variables with clearenv() or equivalent before invoking external programs to minimize the . Specialized tools can further enhance isolation and management of environment variables. In application development, libraries like dotenv load variables from .env files at startup, keeping them separate from the global environment and allowing easy exclusion from via .gitignore. This facilitates environment-specific configurations without direct export to the . In containerized environments, 's --env-file option during docker run or in Compose files injects variables from a file into the container's only, isolating them from the host system and supporting rotation without rebuilding images. best practices emphasize using such files for non-sensitive configs while reserving secrets for volume mounts or integrated managers to avoid exposure. Regular auditing is crucial for maintaining . Inspect the environment periodically using commands like [env](/page/Env) | [grep](/page/Grep) -i sensitive to identify and review potentially exposed variables, integrating this into pipelines or scans. Where modification risks exist, declare variables as read-only in with the readonly builtin (e.g., readonly VAR=value), which prevents reassignment or unexport within the current shell session and its children. recommends combining these audits with automated scanning tools to detect hardcoded or leaked secrets across systems.

References

  1. [1]
    Environment Variables - Doppler
    Environment Variables are dynamic named values that allow applications and their underlying operating system to modify configuration settings without directly ...
  2. [2]
    environ(7) - Linux manual page - man7.org
    Environment variables specific to a particular program or library function are documented in the ENVIRONMENT section of the appropriate manual page. USER The ...
  3. [3]
    Environment Variables - The Open Group Publications Catalog
    Environment variables defined in this chapter affect the operation of multiple utilities, functions, and applications.
  4. [4]
    Linux environment variable tips and tricks - Red Hat
    Dec 18, 2019 · Environment variables exist to enhance and to standardize your shell environment on Linux systems. There are standard environment variables that the system ...
  5. [5]
    What Are Environment Variables: A Guide For Beginners - DreamHost
    Mar 29, 2024 · Environment variables are dynamic named values that can affect how running processes behave on a computer.Why Are Environment... · How Can You Define... · How Do You Access...
  6. [6]
    All you need to know about Unix environment variables
    Environment variables are variables that are set up in your shell when you log in. They are called “environment variables” because most of them affect the way ...
  7. [7]
    UNIX: Set Environment Variable - nixCraft
    Apr 14, 2011 · Open the terminal and type the following commands to display all environment variables and their values under UNIX-like operating systems.For Korn Shell (ksh) · For Bourne Shell (sh And... · Example: Unix C Shell...
  8. [8]
    Environment Variables
    Environment Variable Definition. Environment variables defined in this chapter affect the operation of multiple utilities, functions and applications. There ...
  9. [9]
    2. Shell Command Language
    It is unspecified whether environment variables that were passed to the shell when it was invoked, but were not used to initialize shell variables (see Shell ...
  10. [10]
    Environment Variables - The Open Group Publications Catalog
    Environment variables defined in this chapter affect the operation of multiple utilities, functions, and applications.
  11. [11]
    Bash Variables (Bash Reference Manual)
    ### Summary of Shell Variables vs. Environment Variables in Bash
  12. [12]
    Languages, Levels, Libraries, and Longevity - ACM Queue
    Dec 27, 2004 · The variables got generalized into the “environment variables” designed for 7th Edition Unix. Al Aho, Peter Weinberger, and Brian Kernighan had ...Missing: origin | Show results with:origin
  13. [13]
    Environment Variables: What They Are and How To Use Them - Kinsta
    Oct 1, 2025 · Environment variables are used to store app secrets and configuration data, which are retrieved by your running app when needed.How To Store Environment... · How To Work With... · Environment Variable Tutorial
  14. [14]
    Environment Variables: How to Use Them and 4 Critical Best Practices
    Oct 25, 2023 · One of the most common uses of environment variables is to store configuration settings for software applications. These settings can ...
  15. [15]
    Another thing V7 Unix gave us is environment variables
    Jul 28, 2025 · This implies that the V7 shell is where $PATH first appeared in Unix, where the manual page describes it as 'the search path for commands'. This ...
  16. [16]
    DOS 2.0 and 2.1 | OS/2 Museum
    The batch language was significantly overhauled in DOS 2.0. Besides the ability to use environment variables, branching was now supported with the IF command.
  17. [17]
    Managing NT Environment Variables - ITPro Today
    NT has two kinds of environment variables: system and user. System variables are available any time the OS is running. You can break these variables down into ...Missing: history | Show results with:history
  18. [18]
    Keeping Secrets: A Deep Dive into Robust and Secure Environment ...
    Nov 14, 2023 · Portability: Environment variables allow for a more portable setup since developers can easily change the environment the application runs ...
  19. [19]
    Environment Variables - Win32 apps - Microsoft Learn
    Jul 14, 2025 · Every process has an environment block that contains a set of environment variables and their values. There are two types of environment variables.
  20. [20]
    Can the child process affect parent process' environment?
    Feb 20, 2012 · The child inherits a copy of the parent's environment at the moment of the fork(). Subsequent changes to the environment in either process do not affect the ...How to not propagate environmental variables to command of a ...How to preserve the change in a variable that made in child process ...More results from stackoverflow.com
  21. [21]
    Question about global environment variables and fork() & exec()
    Dec 18, 2018 · There are no global environment variables. They are passed from parent to child. fork does not change the environment variables. exec ...Does running exec command preserves environment variables of ...Exception of inheritance of environment variablesMore results from unix.stackexchange.comMissing: POSIX | Show results with:POSIX
  22. [22]
    Command Execution Environment (Bash Reference Manual)
    Shell functions defined during execution or inherited from the shell's parent in the environment. Options enabled at invocation (either by default or with ...<|control11|><|separator|>
  23. [23]
    How to Set and Use Linux Environment Variables | Linode Docs
    May 4, 2021 · Environment variables are inherited by sub-shells, and are available to applications, and daemons. You can also create and set your own ...
  24. [24]
    CONFIG.SYS - SET Statements - EDM2
    Feb 23, 2020 · Environment variables are stored by OS/2 in memory and can be called by any program. They are used by many programs to store information ...
  25. [25]
    set (environment variable) - Windows commands - Microsoft Learn
    Sep 6, 2023 · These settings usually include the COMSPEC and PATH environment variables, which are used to help find programs on disk. Two other environment ...
  26. [26]
    MS-DOS v6.22 Help: Set
    Dec 7, 2002 · The SET command is often used in the AUTOEXEC.BAT ... These settings usually include the COMSPEC and PATH environment variables that MS-DOS uses ...
  27. [27]
    What Are the Default Environment Variables in Windows?
    Jun 1, 2025 · What are the default environment variables in Windows? · %ALLUSERSPROFILE% · %APPDATA% · %CommonProgramFiles% · %CommonProgramFiles(x86)% · % ...
  28. [28]
    OS/2 2.0 CONFIG.SYS DESCRIPTION - OS2World.Com Wiki
    May 5, 2024 · Set the DOS PROMPT default in your AUTOEXEC.BAT file. Options include: $D = Current date: $E = ASCII code 27 (escape) so ...
  29. [29]
    [PDF] Demystifying CONFIG.SYS in OS/2 2.0 . part 2 - The MESSUI Place
    BAT. The five environment variables OS/2 uses to control the overall operation of system utilities and. OS/2 applications are BOOKSHELF,.
  30. [30]
  31. [31]
  32. [32]
  33. [33]
    Environment variables - ArchWiki
    Aug 31, 2025 · An environment variable is a named object that contains data used by one or more applications. In simple terms, it is a variable with a name and a value.<|separator|>
  34. [34]
    UNIX / Linux set your PATH Variable Using set or export - nixCraft
    Aug 7, 2025 · Let us see how to set your PATH variable using the set command and export command under Linux or Unix-like systems.Missing: documentation | Show results with:documentation
  35. [35]
    How To View and Update the Linux PATH Environment Variable
    Jul 20, 2022 · export PATH=$PATH: /the/file/path : /the/file/path2. Once the export command is executed, you can view the PATH variable to see the changes:.
  36. [36]
    Recognized environment variables | Microsoft Learn
    Jan 29, 2025 · Learn how to use environment variables to identify folders that can be different on different computers.
  37. [37]
    PROMPT - Windows CMD - SS64.com
    To set the CMD prompt for all sessions, set a permanent environment variable (SETX) with the appropriate prompt text. e.g.. SETX PROMPT $M$_$P$G. The prompt ...
  38. [38]
    Environment Variables in Linux/Unix - GeeksforGeeks
    Jul 19, 2024 · Environment variables, often referred to as ENVs, are dynamic values that wield significant influence over the behavior of programs and processes in the Linux ...
  39. [39]
    Why does attempting to echo an undefined environment variable ...
    Aug 2, 2017 · If you try to echo the value of an undefined variable, and the variable is not defined, then the echo command gets a blank command line, at which point it ...Missing: unix | Show results with:unix
  40. [40]
    Windows Environment Variables - Windows CMD - SS64.com
    Environment variables are mainly used within batch files, they can be created, modified and deleted for a session using the SET command.
  41. [41]
    Batch files - How To ... Verify if Variables are Defined
    Apr 15, 2024 · Other "hidden" variables are __APPDIR__ , CD , __CD__ , CMDCMDLINE , CMDEXTVERSION , ERRORLEVEL , RANDOM and TIME . For more details, see ...
  42. [42]
    Batch files - Errorlevels - Rob van der Woude's Scripting Pages
    Feb 10, 2025 · To check errorlevels during batch file development, use either COMMAND /Z yourbatch.bat to display the errorlevel of every command executed in MS-DOS 7.* ( ...
  43. [43]
    Special Parameters (Bash Reference Manual) - GNU.org
    Special parameters in bash are denoted by characters like * and can only be referenced. Examples include $*, $#, $?, and $0.
  44. [44]
    15 Parameters - zsh
    Parameters may also be special, that is, they have a predetermined meaning to the shell. Special parameters cannot have their type changed or their readonly ...
  45. [45]
    Whats the difference between $status and - Unix Linux Community
    Jan 4, 2010 · $? is from sh/ksh/bash $status is from csh family both means the exit status of the last command.
  46. [46]
    about_Automatic_Variables - PowerShell | Microsoft Learn
    Jan 7, 2025 · Contains the full path of the user's home directory. On Windows, this variable uses the value of the "$Env:USERPROFILE" Windows environment ...
  47. [47]
    SET - Create or modify environment variables - osFree
    CMD.EXE supports the "pseudo-variables" BeginLIBPath and EndLIBPath introduced in OS/2 Warp. If you use either of these as a variable name, CMD ...
  48. [48]
    CWE-214: Invocation of Process Using Visible Sensitive Information
    A process is invoked with sensitive command-line arguments, environment variables, or other elements that can be seen by other processes on the operating system ...Missing: risk | Show results with:risk
  49. [49]
    Secrets Management - OWASP Cheat Sheet Series
    Secrets management involves centralizing, controlling access, preventing leaks, and includes API keys, database credentials, and SSH keys.
  50. [50]
    Environment Variables Don't Keep Secrets: Best Practices for ...
    Jan 25, 2023 · Environment variables are global, accessible to any process, and can be easily dumped. They are not recommended for sensitive data unless other ...
  51. [51]
    Hijack Execution Flow: Path Interception by PATH Environment ...
    Mar 13, 2020 · Adversaries may execute their own malicious payloads by hijacking environment variables used to load libraries.
  52. [52]
    Command Injection - OWASP Foundation
    Command injection is an attack in which the goal is execution of arbitrary commands on the host operating system via a vulnerable application.
  53. [53]
    Buffer Overflow via Environment Variables - OWASP Foundation
    This attack pattern involves causing a buffer overflow through manipulation of environment variables. Once the attacker finds that they can modify an ...
  54. [54]
    Bash specially-crafted environment variables code injection attack
    Sep 30, 2014 · Questions have arisen around whether Red Hat products are vulnerable to CVE-2014-6277 and CVE-2014-6278.
  55. [55]
    Post-Mortem / Root Cause Analysis (April 2021) - Codecov
    Apr 1, 2021 · The threat actor specifically targeted the Codecov Bash Uploader and used it to deliver a malicious payload to all Codecov users utilizing the Bash Uploader.
  56. [56]
    Safe storage of app secrets in development in ASP.NET Core
    Nov 4, 2024 · The Secret Manager tool stores sensitive data during application development. In this context, a piece of sensitive data is an app secret.
  57. [57]
    Quoting Variables
    Advanced Bash-Scripting Guide: Prev, Chapter 5. Quoting, Next. 5.1. Quoting Variables. When referencing a variable, it is generally advisable to enclose its ...
  58. [58]
    Set environment variables - Docker Docs
    Use the environment attribute · Use the env_file attribute · Set environment variables with docker compose run --env · Further resources.Use the environment attribute · Set environment variables with...
  59. [59]
    Best practices | Docker Docs
    Handle sensitive information securely · Understand environment variable precedence · Use specific environment files · Know interpolation · Command line overrides.
  60. [60]
    Best practices for protecting secrets | Microsoft Learn
    Aug 30, 2024 · General best practices · Conduct an audit to identify secrets · Avoid hardcoding secrets · Use secure key stores · Implement secret scanning tools.