APPENDIX BSpecial Parameters
Shell special parameters are variables internal to the shell. These variables reference various items, such as the parameters passed to a script or function, process IDs, and return codes. It is not possible to assign a value to them since they can only be referenced.
This appendix is a compilation of the parameters available in bash, ksh, pdksh, and Bourne sh. All of these variables are accessible in each of the shells mentioned, except for $_, which is not available in the Bourne shell.
It isn't necessarily obvious from the shell man pages that you would need to prepend the variables with a $ sign to reference them. For instance, to find the value of the previous command's return code, you would use a command like ...
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