From the course: Learning Bash Scripting
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Bash expansions and substitutions - Bash Tutorial
From the course: Learning Bash Scripting
Bash expansions and substitutions
When we're working with Bash, either at the command line or in a script, we'll often need to use values that we, as the programmer, don't know when we're composing the script, 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 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's going on. In Bash, the ~ character represents the value of the user's home variable, and it's used in file paths to represent the current user's home…
Contents
-
-
-
(Locked)
What's Bash?4m 24s
-
Pipes and redirections6m 20s
-
(Locked)
Bash builtins and other commands3m 44s
-
(Locked)
Brackets and braces in Bash1m 16s
-
(Locked)
Bash expansions and substitutions2m 18s
-
(Locked)
Brace expansion3m 28s
-
(Locked)
Parameter expansion3m 57s
-
(Locked)
Command substitution2m 14s
-
(Locked)
Arithmetic expansion1m 35s
-
(Locked)
-
-
-
-
-