While it probably isn't necessary at this point for you, we'd like to quickly recap parameter substitutions so that we can place it within the greater context of parameter expansion.
As we stated in the introduction, and as you've seen throughout this book, parameter substitution is nothing more than replacing a variable with its value at runtime. On the command line, this looks a little like the following:
reader@ubuntu:~/scripts/chapter_16$ export word=Script
reader@ubuntu:~/scripts/chapter_16$ echo ${word}
Script
reader@ubuntu:~/scripts/chapter_16$ echo "You're reading: Learn Linux Shell ${word}ing"
You're reading: Learn Linux Shell Scripting
reader@ubuntu:~/scripts/chapter_16$ echo "You're reading: Learn Linux Shell $wording"
You're reading: Learn Linux Shell
Normally in a recap you don't learn any new things, but because we're using this just for context we've managed to sneak some new stuff in here: the export command. export is a shell builtin (as found with type -a export), which we can read about using help export (which is the way to get information for all shell builtins).
We don't always need to use export when setting a variable value: in this instance, we could have also just used word=Script. Normally, when we set a variable, it is only available in our current shell. Any processes that run in a fork of our shell do not have that piece of the environment forked with them: they cannot see the value we have assigned to the variable.
While it is not always necessary, you might encounter the use of export when looking for answers online, so it is good to know what it does!
The rest of the example should speak for itself. We assign a value to a variable, and we use parameter substitution at runtime (in this case, with an echo) to replace the variable name with the actual value.
As a reminder, will we show you why we advise you to always include the curly braces around your variable: it makes sure Bash knows where the name of the variable starts and ends. In the last echo, where we can forget to do this, we see that the variable is resolved incorrectly, and the text does not get printed correctly. While not necessary for all scripts, we think it looks better and is a good practice that you should always follow.