syntax:shellvars

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
syntax:shellvars [2019/07/07 05:19]
thebonsai [HISTSIZE]
syntax:shellvars [2020/06/28 07:07] (current)
thebonsai [PROMPT_COMMANDS]
Line 4: Line 4:
  
 ^parameter^character^expansion description^ ^parameter^character^expansion description^
-|''​*''​|asterisk|The positional parameters starting from the first. When used inside doublequotes (see [[syntax:​quoting | quoting]]), like ''"​$*"'',​ it expands to all positional parameters //as one word//, delimited by the first character ​if the ''​IFS''​ variable (a space in this example): ''"​$1 $2 $3 $4"''​. \\ If ''​IFS''​ is unset, the delimiter used will be always a space, if ''​IFS''​ is NULL, the delimiter will be nothing, which effectively concatenates all the positional parameters without any delimiter. \\ When used unquoted, it will just expand to the strings, one by one, not preserving the word boundaries (i.e. word splitting will split the text again, if it contains ''​IFS''​ characters. \\ See also the [[scripting:​posparams | scripting article about handling positional parameters]].|+|''​*''​|asterisk|The positional parameters starting from the first. When used inside doublequotes (see [[syntax:​quoting | quoting]]), like ''"​$*"'',​ it expands to all positional parameters //as one word//, delimited by the first character ​of the ''​IFS''​ variable (a space in this example): ''"​$1 $2 $3 $4"''​. \\ If ''​IFS''​ is unset, the delimiter used will be always a space, if ''​IFS''​ is NULL, the delimiter will be nothing, which effectively concatenates all the positional parameters without any delimiter. \\ When used unquoted, it will just expand to the strings, one by one, not preserving the word boundaries (i.e. word splitting will split the text again, if it contains ''​IFS''​ characters. \\ See also the [[scripting:​posparams | scripting article about handling positional parameters]].|
 |''​@''​|at-sign|The positional parameters starting from the first. When used inside doublequotes (see [[syntax:​quoting | quoting]]), like ''"​$@"'',​ it expands all positional parameters //as separate words//: ''"​$1"​ "​$2"​ "​$3"​ "​$4"''​ \\ Without doublequotes,​ the behaviour is like the one of ''​*''​ without doublequotes. \\ See also the [[scripting:​posparams | scripting article about handling positional parameters]].| |''​@''​|at-sign|The positional parameters starting from the first. When used inside doublequotes (see [[syntax:​quoting | quoting]]), like ''"​$@"'',​ it expands all positional parameters //as separate words//: ''"​$1"​ "​$2"​ "​$3"​ "​$4"''​ \\ Without doublequotes,​ the behaviour is like the one of ''​*''​ without doublequotes. \\ See also the [[scripting:​posparams | scripting article about handling positional parameters]].|
 |''#''​|hash mark|Number of positional parameters (decimal) \\ See also the [[scripting:​posparams | scripting article about handling positional parameters]].| |''#''​|hash mark|Number of positional parameters (decimal) \\ See also the [[scripting:​posparams | scripting article about handling positional parameters]].|
Line 129: Line 129:
 ^Set by Bash:  |no  ^Default: |n/a  | ^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.+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 ​compatibility ​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 152: Line 152:
 ==== BASH_REMATCH ==== ==== BASH_REMATCH ====
 ^Variable: ​ |''​BASH_REMATCH'' ​ ^Since: ​ |3.0   | ^Variable: ​ |''​BASH_REMATCH'' ​ ^Since: ​ |3.0   |
-^Type: ​ |integer indexed array   ​^Read-only: ​ |yes  |+^Type: ​ |integer indexed array   ​^Read-only: ​ |no  |
 ^Set by Bash:  |yes  ^Default: |n/a  | ^Set by Bash:  |yes  ^Default: |n/a  |
  
Line 161: Line 161:
 with index ''​n''​ is the portion of the string matching the nth parenthesized with index ''​n''​ is the portion of the string matching the nth parenthesized
 subexpression. subexpression.
 +
 +Before Bash version 5.1-alpha this variable was readonly.
  
 ==== BASH_SOURCE ==== ==== BASH_SOURCE ====
Line 313: Line 315:
 ==== EPOCHSECONDS ==== ==== EPOCHSECONDS ====
 ^Variable: ​ |''​EPOCHSECONDS'' ​ ^Since: ​ |5.0-alpha ​  | ^Variable: ​ |''​EPOCHSECONDS'' ​ ^Since: ​ |5.0-alpha ​  |
-^Type: ​ |integer ​indexed array   ^Read-only: ​ |no  |+^Type: ​ |integer ​variable ​  ^Read-only: ​ |no  |
 ^Set by Bash:  |yes  ^Default: |n/a  | ^Set by Bash:  |yes  ^Default: |n/a  |
  
Line 977: Line 979:
 If set, the value is executed as a command prior to issuing each If set, the value is executed as a command prior to issuing each
 primary prompt. primary prompt.
 +
 +==== PROMPT_COMMANDS ====
 +^Variable: ​ |''​PROMPT_COMMANDS'' ​ ^Since: ​ |5.1-alpha ​  |
 +^Type: ​ |integer indexed array  ^Read-only: ​ |no  |
 +^Set by Bash:  |no  ^Default: |n/a  |
 +
 +If set, each element is executed as a command prior to issuing each
 +primary prompt (like ''​PROMPT_COMMAND'',​ just as array).
  
 ==== PROMPT_DIRTRIM ==== ==== PROMPT_DIRTRIM ====
Line 1037: Line 1047:
 If it is not set when the shell starts, Bash assigns the full pathname If it is not set when the shell starts, Bash assigns the full pathname
 of the current user's login shell. of the current user's login shell.
 +
 +==== SRANDOM ====
 +^Variable: ​ |''​SRANDOM'' ​ ^Since: ​ |5.1-alpha ​  |
 +^Type: ​ |normal variable ​ ^Read-only: ​ |no  |
 +^Set by Bash:  |yes  ^Default: |n/a  |
 +
 +A variable that delivers a 32bit random number. The random number generation uses platform specific generators in the background and a builtin fallback generator.
  
 ==== TIMEFORMAT ==== ==== TIMEFORMAT ====
  • syntax/shellvars.1562476740.txt
  • Last modified: 2019/07/07 05:19
  • by thebonsai