Shell Variables

This is a list of special variables that configure a shell's behavior. For programming variables, including special ones, see here.


Bash Internals

Constants

$PPID is the PID of the shell's parent.

Files and Directories

$ENV is a startup file used when sh(1) is used as a script interpretter.

Not Useful

$LINENO is the line number of the currently executing command.


Inter Field Separator

$IFS defines the characters that should be interpreted as separating tokens.

Frequently, this is only manipulated when writing a pipeline that specially delimits items with the null byte.


Locale

$LC_COLLATE, $LC_CTYPE, $LC_MESSAGES are all used in different contexts to determine the current locale.

$LANG is the fallback value. $LC_ALL overrides $LANG and all of the above if set.


Paths

$PWD is the current working directory.

$PATH is a colon-delimited list of directories searched for commands.


Prompts

$PS1 is printed at the beginning of every command prompt.

$PS2 is printed at the beginning of run-on lines.

$PS4 is printed on traces.


User

$HOME is the user's home directory.


CategoryRicottone

Shell/ShellVariables (last edited 2023-01-30 02:26:52 by DominicRicottone)