Built-in Shell Variables
Built-in variables are set automatically by the shell and are typically used inside shell scripts. Built-in variables can use the variable substitution patterns shown earlier. When setting variables, you don’t include dollar signs, but when referencing their values later, the dollar signs are necessary.
Tables 5-26 through Table 5-29 show the commonly used built-in variables in bash.
|
Variable |
Meaning |
|
|
Allows a background job to be brought to the foreground simply by entering a substring of the job’s command line. Values can be |
|
|
Startup file of commands to execute, if bash is invoked to run a script. |
|
|
Colon-separated list of directories to search for the directory passed in a cd command. |
|
|
Pathname of your preferred text editor. |
|
|
Word separator; used by shell to parse commands into their elements. The default separators are space, tab, and newline. |
|
|
If nonzero, don’t allow use of a single Ctrl-D (the end-of-file or EOF character) to log off; use the exit command to log off. |
|
|
Colon-separated list of directories to search for each command. |
|
|
Command that bash executes before issuing a prompt for a new command. |
|
|
Prompt displayed before each new command; ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access