]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/posixexp2.sub
bash-5.1 distribution sources and documentation
[thirdparty/bash.git] / tests / posixexp2.sub
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.
5 #
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.
10 #
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/>.
13 #
14
15 x=a\ b
16 [ "$x" = "${x?}" ] || exit 1
17 set -- ${x?}
18 { [ "$#" = 2 ] && [ "$1" = a ] && [ "$2" = b ]; } || exit 1
19 unset x
20 (echo ${x?abcdefg}) 2>&1 | grep abcdefg >/dev/null || exit 1
21 ${THIS_SH} -c 'unset foo; echo ${foo?}' 2>/dev/null && exit 2
22 ${THIS_SH} -c 'foo=; echo ${foo:?}' 2>/dev/null && exit 3
23 ${THIS_SH} -c 'foo=; echo ${foo?}' >/dev/null || exit 4
24 ${THIS_SH} -c 'foo=1; echo ${foo:?}' >/dev/null || exit 5
25 ${THIS_SH} -c 'echo ${!?}' 2>/dev/null && exit 6
26 ${THIS_SH} -c ':& echo ${!?}' >/dev/null || exit 7
27 ${THIS_SH} -c 'echo ${#?}' >/dev/null || exit 8
28 ${THIS_SH} -c 'echo ${*?}' 2>/dev/null && exit 9
29 ${THIS_SH} -c 'echo ${*?}' ${THIS_SH} x >/dev/null || exit 10
30 ${THIS_SH} -c 'echo ${1?}' 2>/dev/null && exit 11
31 ${THIS_SH} -c 'echo ${1?}' ${THIS_SH} x >/dev/null || exit 12
32 ${THIS_SH} -c 'echo ${2?}' ${THIS_SH} x 2>/dev/null && exit 13
33 ${THIS_SH} -c 'echo ${2?}' ${THIS_SH} x y >/dev/null || exit 14
34
35 ${THIS_SH} -c $'echo $(( x+ )) \n exit 0' ${THIS_SH} 2>/dev/null && exit 15
36
37 exit 0