]>
Commit | Line | Data |
---|---|---|
deb63bfb | 1 | # $FreeBSD: head/bin/sh/tests/expansion/set-u1.0 213738 2010-10-12 18:20:38Z obrien $ |
71aad674 A |
2 | |
3 | ${SH} -uc 'unset foo; echo $foo' 2>/dev/null && exit 1 | |
4 | ${SH} -uc 'foo=; echo $foo' >/dev/null || exit 1 | |
5 | ${SH} -uc 'foo=1; echo $foo' >/dev/null || exit 1 | |
6 | # -/+/= are unaffected by set -u | |
7 | ${SH} -uc 'unset foo; echo ${foo-}' >/dev/null || exit 1 | |
8 | ${SH} -uc 'unset foo; echo ${foo+}' >/dev/null || exit 1 | |
9 | ${SH} -uc 'unset foo; echo ${foo=}' >/dev/null || exit 1 | |
10 | # length/trimming are affected | |
11 | ${SH} -uc 'unset foo; echo ${#foo}' 2>/dev/null && exit 1 | |
12 | ${SH} -uc 'foo=; echo ${#foo}' >/dev/null || exit 1 | |
13 | ${SH} -uc 'unset foo; echo ${foo#?}' 2>/dev/null && exit 1 | |
14 | ${SH} -uc 'foo=1; echo ${foo#?}' >/dev/null || exit 1 | |
15 | ${SH} -uc 'unset foo; echo ${foo##?}' 2>/dev/null && exit 1 | |
16 | ${SH} -uc 'foo=1; echo ${foo##?}' >/dev/null || exit 1 | |
17 | ${SH} -uc 'unset foo; echo ${foo%?}' 2>/dev/null && exit 1 | |
18 | ${SH} -uc 'foo=1; echo ${foo%?}' >/dev/null || exit 1 | |
19 | ${SH} -uc 'unset foo; echo ${foo%%?}' 2>/dev/null && exit 1 | |
20 | ${SH} -uc 'foo=1; echo ${foo%%?}' >/dev/null || exit 1 | |
21 | ||
22 | ${SH} -uc 'echo $!' 2>/dev/null && exit 1 | |
23 | ${SH} -uc ':& echo $!' >/dev/null || exit 1 | |
24 | ${SH} -uc 'echo $#' >/dev/null || exit 1 | |
25 | ${SH} -uc 'echo $1' 2>/dev/null && exit 1 | |
26 | ${SH} -uc 'echo $1' ${SH} x >/dev/null || exit 1 | |
27 | ${SH} -uc 'echo $2' ${SH} x 2>/dev/null && exit 1 | |
28 | ${SH} -uc 'echo $2' ${SH} x y >/dev/null || exit 1 | |
29 | exit 0 |