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