Error:

Use default values

# var is not set
# prints "something" to stdout, var remains unset
echo ${var:-something}

var=test
# prints "test" to stdout, var value remains "test"
echo ${var:-something}

Assign default values

# var is not set
# prints "something" to stdout, var value becomes "something"
echo ${var:=something}

var=test
# prints "test" to stdout, var value remains "test"
echo ${var:=something}

Display error if null or unset

# var is unset
# Prints "var: Var is not set" and exits
echo ${var:?Var is not set}

var=test
# Prints "test"
echo ${var:?Var is not set}

Use alternate value

# var is not set
# prints empty string to stdout, var remains unset
echo ${var:+something}

var=test
# prints "something" to stdout, var value remains "test"
echo ${var:+something}

Set variable to the output from command

files=$(ls -1)