Variable Substitution
No spaces should be used in the following expressions. The colon (:) is optional; if it’s included, var must be nonnull, as well as set.
Variable expression | Description |
|---|---|
| Set each variable
|
${
| Use value of
|
${
| Use
|
${
| Use
|
${
| Use
|
${
| Use
|
${#
| Use the length of
|
${#*}, ${#@} | Use the number of positional parameters. |
${
| Use value of
|
${
| Same as # |
${
| Use value of
|
${
| Same as % |
${!
| List of variables whose
names begin with
|
${
| Starting at position
|
${
| Use value of
|
${
| Use value ... |
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