Shell: Document the use of environment/local variables

This commit is contained in:
AnotherTest 2020-08-18 02:11:42 +04:30 committed by Andreas Kling
parent 32bfb48577
commit 68189f80cc
Notes: sideshowbarker 2024-07-19 03:27:07 +09:00
2 changed files with 41 additions and 0 deletions

View file

@ -38,3 +38,7 @@ Shell -c 'rm foo*'
# Execute the contents of a file with some arguments
Shell foo a b c
```
## See also
* [`Shell-vars`(7)](../man7/Shell-vars.md) For details on local and environment variables used by the shell

View file

@ -0,0 +1,37 @@
## Name
Shell Variables - Special local and environment variables used by the Shell
## Description
The Shell uses various variables to allow for customisations of certain behavioural or visual things.
Such variables can be changed or set by the user to tweak how the shell presents things.
## Behavioural
1. Output interpretations
`IFS` (local)
The value of this variable is used to join lists or split strings into lists, its default value is a newline (`\\n`).
## Visual
2. Prompting
`PROMPT` (environment)
The value of this variable is used to generate a prompt, the following escape sequences can be used literally inside the value, and they would expand to their respective values:
- `\\u` : the current username
- `\\h` : the current hostname
- `\\w` : a collapsed path (relative to home) to the current directory
- `\\p` : the string '$' (or '#' if the user is 'root')
Any other escaped character shall be ignored.
`PROMPT_EOL_MARK` (environment)
The value of this variable is used to denote the ends of partial lines (lines with no newline), its default value is '%'.