In this second-to-last chapter, with the final chapter being tips and tricks, we will deal with a very cool feature of Bash: parameter expansion.
We'll begin with a few notes on terminology. First of all, what's considered parameter expansion in Bash deals with more than just parameters/arguments supplied to a script: all special operations we'll be discussing in this chapter are applicable to Bash variables. In the official Bash manual page (man bash), these are all referred to as parameters.
For positional arguments to scripts, or even options with arguments, this makes sense. However, once we enter the territory of constants defined by the script creator, the distinction between a constant/variable and a parameter gets a bit muddy. This is of no further consequence; just remember that when you see the word parameter in a man page, it might be referring to variables in general.
Secondly, people tend to be a bit confused about the terms parameter expansion and parameter substitution, and you'll see these terms used interchangeably on the internet. In the official documentation, the word substitution is only used in command substitution and process substitution.
Command substitution is something we've discussed: it's the $(...) syntax. Process substitution is pretty advanced and has not been described: if you ever come across <(...) syntax, you're dealing with process substitution. We've included an article on process substitution in the Further reading section of this chapter, so be sure to give it a look.
The confusion, we think, stems from the fact that parameter substitution, that is, the replacing of the variable name with its value at runtime, is considered only a small part of the greater parameter expansion in Bash. That is why you will see some articles or sources refer to all the great features of parameter expansion (default values, case manipulation, and pattern removal, to name a few) as parameter substitution.
Again, just remember that these terms are often interchanged, and people are (probably) talking about the same thing. If you are ever in doubt yourself, we would advise opening up the Bash man page on any of your machines, and sticking with the official designation: parameter expansion.