1parameter=abcdef
2offset=2
3noffset=-2
4echo "parameter     '${parameter}'"
5echo "varoffset2    '${parameter:${offset}}'"
6echo "varoffset-2   '${parameter:${noffset}}'"
7echo "literal '2'   '${parameter:2}'"
8# This is not interpreted as ${VAR:POS{:LEN}},
9# but as ${VAR:=WORD} - if VAR is unset or null, substitute WORD
10echo "literal '-2'  '${parameter:-2}'"
11echo "literal ' -2' '${parameter: -2}'"
12