Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
syntax:shellvars [2011/06/20 20:23]
thebonsai [REPLY]
syntax:shellvars [2019/02/20 08:29]
steventhedev added PS0
Line 91: Line 91:
 bottom. When a subroutine is executed, the parameters supplied are pushed onto bottom. When a subroutine is executed, the parameters supplied are pushed onto
 ''​BASH_ARGV''​. ''​BASH_ARGV''​.
 +
 +==== BASH_ARGV0 ====
 +
 +^Variable: ​ |''​BASH_ARGV0'' ​ ^Since: ​ |5.0-alpha ​  |
 +^Type: ​ |string ​ ^Read-only: ​ |no  |
 +^Set by Bash:  |yes  ^Default: |same as ''​$0'' ​ |
 +
 +Expands to the name of the shell or shell script - as the special parameter ''​$0''​ does. Assignments to ''​BASH_ARGV0''​ causes the value to be assigned to ''​$0''​.
 +
 +If this parameter is unset, it loses its special properties, even if subsequently reset.
 +
  
 ==== BASH_CMDS ==== ==== BASH_CMDS ====
Line 112: Line 123:
 is executing a command as the result of a trap, in which case it is the command is executing a command as the result of a trap, in which case it is the command
 executing at the time of the trap. executing at the time of the trap.
 +
 +==== BASH_COMPAT ====
 +^Variable: ​ |''​BASH_COMPAT'' ​ ^Since: ​ |4.3-alpha ​ |
 +^Type: ​ |normal variable ​  ​^Read-only: ​ |no  |
 +^Set by Bash:  |no  ^Default: |n/a  |
 +
 +The value is used to set the shell'​s compatibility level. The value may be a decimal number (e.g., ''​4.2''​) or an integer (e.g., ''​42''​) corresponding to the desired com patibility level. If ''​BASH_COMPAT''​ is unset or set to the empty string, the compatibility level is set to the default for the current version. If  ''​BASH_COMPAT''​ is set to a value that is not one of the valid compatibility levels, the shell prints an error message and sets the compatibility level to the default for the current version. The valid compatibility levels correspond to the compatibility options accepted by the shopt builtin. The current version is also a valid value.
  
 ==== BASH_EXECUTION_STRING ==== ==== BASH_EXECUTION_STRING ====
Line 161: Line 179:
  
 ==== BASH_VERSINFO ==== ==== BASH_VERSINFO ====
-^Variable: ​ |''​BASH_VERSINFO'' ​ ^Since: ​ |unknown ​  |+^Variable: ​ |''​BASH_VERSINFO'' ​ ^Since: ​ |2.0   |
 ^Type: ​ |integer indexed array   ​^Read-only: ​ |yes  | ^Type: ​ |integer indexed array   ​^Read-only: ​ |yes  |
 ^Set by Bash:  |yes  ^Default: |n/a  | ^Set by Bash:  |yes  ^Default: |n/a  |
Line 181: Line 199:
  
 Expands to a string describing the version of this instance of Bash. Expands to a string describing the version of this instance of Bash.
 +
 +Since Bash 2.0 it includes the shell'​s "​release status"​ (alpha[N], beta[N], release).
 +
 +==== CHILD_MAX ====
 +^Variable: ​ |''​CHILD_MAX'' ​ ^Since: ​ |4.3-alpha ​  |
 +^Type: ​ |normal variable ​  ​^Read-only: ​ |no  |
 +^Set by Bash:  |no  ^Default: |n/a  |
 +
 +Set the number of exited child status values for the shell to remember. Bash will not allow this value to be decreased below a POSIX-mandated minimum, and there is a maximum value (currently 8192) that this may not exceed. The minimum value is system-dependent.
 +
 +
  
 ==== COMP_CWORD ==== ==== COMP_CWORD ====
Line 272: Line 301:
  
 If this parameter is unset, it loses its special properties, even if it is subsequently reset. If this parameter is unset, it loses its special properties, even if it is subsequently reset.
 +
 +==== EPOCHREALTIME ====
 +^Variable: ​ |''​EPOCHREALTIME'' ​ ^Since: ​ |5.0-alpha ​  |
 +^Type: ​ |integer variable ​  ​^Read-only: ​ |no  |
 +^Set by Bash:  |yes  ^Default: |n/a  |
 +
 +Expands to the number of seconds since Unix expoch as a floating point value with micro-second granularity.
 +
 +Assignments to this parameter are ignored. If this parameter is unset, it loses its special properties, even if it is subsequently reset.
 +
 +==== EPOCHSECONDS ====
 +^Variable: ​ |''​EPOCHSECONDS'' ​ ^Since: ​ |5.0-alpha ​  |
 +^Type: ​ |integer indexed array   ​^Read-only: ​ |no  |
 +^Set by Bash:  |yes  ^Default: |n/a  |
 +
 +Expands to the number of seconds since Unix expoch.
 +
 +Assignments to this parameter are ignored. If this parameter is unset, it loses its special properties, even if it is subsequently reset.
 +
  
 ==== EUID ==== ==== EUID ====
Line 279: Line 327:
  
 Expands to the effective user ID of the current user, initialized at shell startup. Expands to the effective user ID of the current user, initialized at shell startup.
 +
 +:!: Do not rely on this variable when security is a concern.
  
 ==== FUNCNAME ==== ==== FUNCNAME ====
Line 419: Line 469:
  
 ==== PIPESTATUS ==== ==== PIPESTATUS ====
-^Variable: ​ |''​PIPESTATUS'' ​ ^Since: ​ |unknown ​  |+^Variable: ​ |''​PIPESTATUS'' ​ ^Since: ​ |2.0   |
 ^Type: ​ |integer indexed array  ^Read-only: ​ |no  | ^Type: ​ |integer indexed array  ^Read-only: ​ |no  |
 ^Set by Bash:  |yes  ^Default: |n/a  | ^Set by Bash:  |yes  ^Default: |n/a  |
Line 513: Line 563:
  
 Expands to the user ID of the current user, initialized at shell startup. Expands to the user ID of the current user, initialized at shell startup.
 +
 +:!: Do not rely on this variable when security is a concern.
  
 ==== BASH_ENV ==== ==== BASH_ENV ====
Line 666: Line 718:
 ^Variable: ​ |''​HISTFILESIZE'' ​ ^Since: ​ |unknown ​  | ^Variable: ​ |''​HISTFILESIZE'' ​ ^Since: ​ |unknown ​  |
 ^Type: ​ |normal variable ​ ^Read-only: ​ |no  | ^Type: ​ |normal variable ​ ^Read-only: ​ |no  |
-^Set by Bash:  |if unset  ^Default: |500  |+^Set by Bash:  |if unset  ^Default: |''​HISTSIZE'' ​ |
  
 The maximum number of lines contained in the history file. The maximum number of lines contained in the history file.
Line 672: Line 724:
 When this variable is assigned a value, the history file is truncated, When this variable is assigned a value, the history file is truncated,
 if necessary, by removing the oldest entries, to contain no more than the if necessary, by removing the oldest entries, to contain no more than the
-given number of lines.+given number of lines. If the given number of lines is 0 (zero), the file is truncated to zero size. 
 +Non-numeric values and numeric values less than zero inhibit truncation.
  
 The history file is also truncated to this size after writing it The history file is also truncated to this size after writing it
Line 678: Line 731:
  
 ==== HISTIGNORE ==== ==== HISTIGNORE ====
-^Variable: ​ |''​HISTIGNORE'' ​ ^Since: ​ |unknown ​  |+^Variable: ​ |''​HISTIGNORE'' ​ ^Since: ​ |2.0   |
 ^Type: ​ |normal variable ​ ^Read-only: ​ |no  | ^Type: ​ |normal variable ​ ^Read-only: ​ |no  |
 ^Set by Bash:  |no  ^Default: |n/a  | ^Set by Bash:  |no  ^Default: |n/a  |
Line 702: Line 755:
  
 The number of commands to remember in the command history. The number of commands to remember in the command history.
 +
 +If the number is set to 0 (zero), then the history list is disabled. If the number is set to any negative number, then the history list is unlimited.
  
 ==== HISTTIMEFORMAT ==== ==== HISTTIMEFORMAT ====
Line 723: Line 778:
 The home directory of the current user. The home directory of the current user.
  
-The default argument for the [[commands:​builtin:​cd|cd builtin command]].++The default argument for the [[commands:​builtin:​cd|cd builtin command]].
  
 The value of this variable is also used when performing The value of this variable is also used when performing
Line 895: Line 950:
 ^Set by Bash:  |no  ^Default: |system-dependent (set on compile time)  | ^Set by Bash:  |no  ^Default: |system-dependent (set on compile time)  |
  
-The search path for commands. +The search path for commands. ​This is a colon-separated list of directories in which the shell looks for commands.
- +
-It is a colon-separated list of directories in which the shell looks for commands.+
  
 A zero-length (null) directory name in the value of ''​PATH''​ indicates the current directory. A zero-length (null) directory name in the value of ''​PATH''​ indicates the current directory.
Line 904: Line 957:
 trailing colon. trailing colon.
  
 +There can be a static path compiled in for use in a restricted shell.
 ==== POSIXLY_CORRECT ==== ==== POSIXLY_CORRECT ====
 ^Variable: ​ |''​POSIXLY_CORRECT'' ​ ^Since: ​ |unknown ​  | ^Variable: ​ |''​POSIXLY_CORRECT'' ​ ^Since: ​ |unknown ​  |
Line 934: Line 988:
  
 Characters removed are replaced with an ellipsis. Characters removed are replaced with an ellipsis.
 +
 +==== PS0 ====
 +^Variable: ​ |''​PS0'' ​ ^Since: ​ |4.4.0 ​  |
 +^Type: ​ |normal variable ​ ^Read-only: ​ |no  |
 +^Set by Bash:  |if unset  ^Default: |"''''" ​ |
 +
 +The value of this parameter is expanded and used as the primary prompt string.
  
 ==== PS1 ==== ==== PS1 ====
  • syntax/shellvars.txt
  • Last modified: 2019/07/07 05:19
  • by thebonsai