aboutsummaryrefslogtreecommitdiff
path: root/shell/ash_test/ash-vars/var_posix1.tests
blob: 82abe81984c579238a785c00addc4b4722e3bae6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
unset var

echo Empty:${var#}
echo Empty:${var##}
echo Empty:${var#*}
echo Empty:${var##*}
echo Empty:${var%}
echo Empty:${var%%}
echo Empty:${var%*}
echo Empty:${var%%*}

var=

echo Empty:${var#}
echo Empty:${var##}
echo Empty:${var#*}
echo Empty:${var##*}
echo Empty:${var%}
echo Empty:${var%%}
echo Empty:${var%*}
echo Empty:${var%%*}

var=ababcdcd

echo ${var#ab}
echo ${var##ab}
echo ${var#a*b}
echo ${var##a*b}
echo ${var#?}
echo ${var##?}
echo ${var#*}
echo Empty:${var##*}
echo ${var#}}_tail
echo ${var#\}}_tail

echo ${var%cd}
echo ${var%%cd}
echo ${var%c*d}
echo ${var%%c*d}
echo ${var%?}
echo ${var%%?}
echo ${var%*}
echo Empty:${var%%*}
echo ${var#}}_tail
echo ${var#\}}_tail
echo ${var%\\*}

a=ab}; echo ${a%\}};
a=abc; c=c; echo ${a%${c}}
a=ab{{c; echo ${a%`echo {{c`}

echo End