Bash special parameters are shell-managed, unassignable parameters denoted by specific single characters that store execution context, process state, and positional arguments. With the exception ofDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
_, they are strictly classified as parameters rather than variables. Bash defines a variable as a parameter denoted by a valid name (consisting of alphanumeric characters and underscores, starting with a letter or underscore); because special characters like *, @, ?, and $ are not valid identifiers, they are not variables. Furthermore, they are not “read-only” (which implies a value cannot be modified by anything once set), but rather unassignable by the user, as their values are constantly updated by the shell’s internal execution engine.
They are accessed using standard parameter expansion syntax:
Positional and Argument Parameters
$*(Asterisk): Expands to the positional parameters, starting from one. When unquoted, it behaves identically to an unquoted$@, expanding to the positional parameters where each is subject to word splitting and pathname expansion. When the expansion occurs within double quotes ("$*"), it expands to a single word containing the value of each parameter, separated by the first character of the Internal Field Separator (IFS) special variable. IfIFSis unset, the parameters are separated by a space. IfIFSis explicitly set to null, the parameters are concatenated together without any separator. If there are exactly zero positional parameters,"$*"expands to a single empty string (one empty word).$@(At Sign): Expands to the positional parameters, starting from one. When unquoted, it behaves identically to an unquoted$*. When the expansion occurs within double quotes ("$@"), each parameter expands to a separate, distinct word, preventing word splitting on individual arguments that contain spaces. If there are exactly zero positional parameters,"$@"expands to nothing (zero words).$#(Hash): Expands to the decimal integer representing the total number of positional parameters currently set.$0(Zero): Expands to the name of the shell or shell script. This is set at shell initialization. If Bash is invoked with a file of commands,$0is set to the name of that file.
Process and State Parameters
$?(Question Mark): Expands to the exit status (return code) of the most recently executed foreground pipeline.$$(Dollar Sign): Expands to the Process ID (PID) of the current shell. In a subshell environment,$$expands to the PID of the invoking parent shell, not the subshell itself.$!(Exclamation Point): Expands to the Process ID of the job most recently placed into the background, whether executed as an asynchronous command (using&) or manipulated via thebgbuiltin.$-(Hyphen): Expands to the current shell option flags. This includes flags specified upon invocation, flags set via thesetbuiltin command, or flags implicitly set by the shell’s operational mode (e.g.,ifor interactive,mfor monitor mode).$_(Underscore): At shell startup, this expands to the absolute pathname used to invoke the shell or shell script. Subsequently, it expands to the last argument to the previous simple command executed in the foreground, after all expansions have been performed. Additionally, it is set to the full pathname used to invoke each command executed and is placed in the environment exported to that command.
Master Bash with Deep Grasping Methodology!Learn More





