• Strings cheatsheet for substituting values in strings.

Assign

$ X=abc
$ X='abc'
$ X='abc def'
$ X="abc $USER"

Reference

Basic

Y=$X

# Preferred esp for multi-word and multi-line values.
Y="$X"

Curly braces

Y="${X}"

This can be useful to stop the variable name from being evaulated correctly or looking confusing.

# Compare with "$Xbar" which would reference Xbar variable unexpectedly.
Y="${X}bar"

# Compare with "$X_Z" which would reference X_Z variable unexpectedly.
Y="${X}_Z"

It can be used for positional parameters.

echo $8 $9 ${10} ${11}

Also useful for parameter expansion for more advanced use as in the linked strings cheatsheet.