blob: d729a62de77c726807e7ec39a2f17b3e90ab23bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# $FreeBSD: src/tools/regression/bin/sh/expansion/set-u1.0,v 1.2 2010/10/12 18:20:38 obrien Exp $
${THIS_SH} -uc 'unset foo; echo ${foo}' 2>/dev/null && exit 1
${THIS_SH} -uc 'unset foo; echo $foo' 2>/dev/null && exit 1
${THIS_SH} -uc 'foo=; echo $foo' >/dev/null || exit 2
${THIS_SH} -uc 'foo=1; echo $foo' >/dev/null || exit 3
# -/+/= are unaffected by set -u
${THIS_SH} -uc 'unset foo; echo ${foo-}' >/dev/null || exit 4
${THIS_SH} -uc 'unset foo; echo ${foo+}' >/dev/null || exit 5
${THIS_SH} -uc 'unset foo; echo ${foo=}' >/dev/null || exit 6
# length/trimming are affected
${THIS_SH} -uc 'unset foo; echo ${#foo}' 2>/dev/null && exit 7
${THIS_SH} -uc 'foo=; echo ${#foo}' >/dev/null || exit 8
${THIS_SH} -uc 'unset foo; echo ${foo#?}' 2>/dev/null && exit 9
${THIS_SH} -uc 'foo=1; echo ${foo#?}' >/dev/null || exit 10
${THIS_SH} -uc 'unset foo; echo ${foo##?}' 2>/dev/null && exit 11
${THIS_SH} -uc 'foo=1; echo ${foo##?}' >/dev/null || exit 12
${THIS_SH} -uc 'unset foo; echo ${foo%?}' 2>/dev/null && exit 13
${THIS_SH} -uc 'foo=1; echo ${foo%?}' >/dev/null || exit 14
${THIS_SH} -uc 'unset foo; echo ${foo%%?}' 2>/dev/null && exit 15
${THIS_SH} -uc 'foo=1; echo ${foo%%?}' >/dev/null || exit 16
${THIS_SH} -uc 'echo $!' 2>/dev/null && exit 17
${THIS_SH} -uc ':& echo $!' >/dev/null || exit 18
${THIS_SH} -uc 'echo $#' >/dev/null || exit 19
${THIS_SH} -uc 'echo $1' 2>/dev/null && exit 20
${THIS_SH} -uc 'echo $1' ${THIS_SH} x >/dev/null || exit 21
${THIS_SH} -uc 'echo $2' ${THIS_SH} x 2>/dev/null && exit 22
${THIS_SH} -uc 'echo $2' ${THIS_SH} x y >/dev/null || exit 23
exit 0
|