]>
Commit | Line | Data |
---|---|---|
1 | # $FreeBSD: head/bin/sh/tests/errors/assignment-error1.0 213738 2010-10-12 18:20:38Z obrien $ | |
2 | IFS=, | |
3 | ||
4 | SPECIAL="break,\ | |
5 | :,\ | |
6 | continue,\ | |
7 | . /dev/null,\ | |
8 | eval,\ | |
9 | exec,\ | |
10 | export -p,\ | |
11 | readonly -p,\ | |
12 | set,\ | |
13 | shift,\ | |
14 | times,\ | |
15 | trap,\ | |
16 | unset foo" | |
17 | ||
18 | # If there is no command word, the shell must abort on an assignment error. | |
19 | ${SH} -c "readonly a=0; a=2; exit 0" 2>/dev/null && exit 1 | |
20 | ||
21 | # Special built-in utilities must abort on an assignment error. | |
22 | set -- ${SPECIAL} | |
23 | for cmd in "$@" | |
24 | do | |
25 | ${SH} -c "readonly a=0; a=2 ${cmd}; exit 0" 2>/dev/null && exit 1 | |
26 | done | |
27 | ||
28 | # Other utilities must not abort; we currently still execute them. | |
29 | ${SH} -c 'readonly a=0; a=1 true; exit $a' 2>/dev/null || exit 1 | |
30 | ${SH} -c 'readonly a=0; a=1 command :; exit $a' 2>/dev/null || exit 1 |