1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 printf "%s\n" ${a:=a\ b}
19 recho ${v=a\ b} x ${v=c\ d}
22 recho "${v=a\ b}" x "${v=c\ d}"
26 recho "foo ${IFS+'bar'} baz"
27 recho "a ${IFS+b c} d"
29 recho "a ${IFS+"b c"} d"
32 recho "foo ${IFS+a$u{{{\}b} c ${IFS+d{}} bar" ${IFS-e{}} baz
56 printf '<%s> ' ${u+x} . ${v+x} . "${u+x}" . "${v+x}" .; echo
57 printf '<%s> ' ${u-x} . ${v-x} . "${u-x}" . "${v-x}" .; echo
58 printf '<%s> ' ${u=x} . ${v=x} . "${u=x}" . "${v=x}" .; echo
59 printf '<%s> ' ${u?x} . ${v?x} . "${u?x}" . "${v?x}" .; echo
60 printf '<%s> ' ${u#x} . ${v#x} . "${u#x}" . "${v#x}" .; echo
61 printf '<%s> ' ${u%x} . ${v%x} . "${u%x}" . "${v%x}" .; echo
62 printf '<%s> ' ${u:+x} . ${v:+x} . "${u:+x}" . "${v:+x}" .; echo
63 printf '<%s> ' ${u:-x} . ${v:-x} . "${u:-x}" . "${v:-x}" .; echo
64 printf '<%s> ' ${u:=x} . ${v:=x} . "${u:=x}" . "${v:=x}" .; echo
65 printf '<%s> ' ${u:?x} . ${v:?x} . "${u:?x}" . "${v:?x}" .; echo
66 # these are invalid substitution operators
67 #printf '<%s> ' ${u:#x} . ${v:#x} . "${u:#x}" . "${v:#x}" .; echo
68 #printf '<%s> ' ${u:%x} . ${v:%x} . "${u:%x}" . "${v:%x}" .; echo
74 recho "foo ${IFS+'bar} baz"
81 cp ${THIS_SH} $TMPDIR/sh
82 THIS_SH=$TMPDIR/sh ${THIS_SH} ./posixexp1.sub || echo "sh posixexp1.sub: test $? failed"
83 ${THIS_SH} ./posixexp1.sub || echo "bush posixexp1.sub: test $? failed"
85 THIS_SH=$TMPDIR/sh ${THIS_SH} ./posixexp2.sub || echo "sh posixexp2.sub: test $? failed"
88 ${THIS_SH} ./posixexp3.sub
89 ${THIS_SH} ./posixexp4.sub
90 ${THIS_SH} ./posixexp5.sub
91 ${THIS_SH} ./posixexp6.sub
92 ${THIS_SH} ./posixexp7.sub
93 ${THIS_SH} ./posixexp8.sub
95 # this will be an error