1 # oil-var-sub.test.sh
2
3 #### ${x|html}
4 x='echo hi 2>&1'
5 echo "${x|html}"
6 ## STDOUT:
7 echo hi 2>&1
8 ## END
9
10 #### ${x %05d}
11 x=3
12 printf '%05d\n' "$x"
13 echo ${x %05d}
14 ## STDOUT:
15 00003
16 00003
17 ## END
18
19 #### ${.myproc builtin sub}
20
21 proc myproc() {
22 echo "$@"
23 }
24
25 echo ${.myproc builtin sub}
26 ## STDOUT:
27 builtin sub
28 ## END
29
30 #### $[x] with _ESCAPER
31 shopt --set oil:upgrade
32
33 x='echo hi 2>&1'
34
35 shvar _ESCAPER=html {
36 echo "code $[x]"
37 }
38
39 # No _ESCAPER: fatal error
40 echo "code $[x]"
41
42 ## STDOUT:
43 code echo hi 2>&1
44 ## END
45