From the course: Learning Bash Scripting

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

Bash expansions and substitutions

Bash expansions and substitutions - Bash Tutorial

From the course: Learning Bash Scripting

Bash expansions and substitutions

- [Instructor] When we're working with Bash, either at the command line or in the script, we'll often need to use values that we don't know. Things like a path to the user's home folder, a piece of user provided information, or the result of a calculation that's based on something we can't foresee. Bash provides us a way to represent these values using expansions and substitutions. Both of these are interpreted when they run and replace themselves with a value or a set of values. I want to introduce them now, because they're very important to scripting. Over the next few videos, we'll take a look at each expansion and substitution, so you're more familiar with them when they pop up later in the course. We'll start with tilde expansion. Which you might actually have already used without being aware of what was going on. In Bash, the tilde character represents the value of the user's $HOME variable. And it's used in paths…

Contents