OILS / spec / ysh-var-sub.test.sh View on Github | oilshell.org

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