Add regression tests for /bin/sh.
[dragonfly.git] / tools / regression / bin / sh / errors / assignment-error1.0
1 # $FreeBSD: src/tools/regression/bin/sh/errors/assignment-error1.0,v 1.3 2010/10/12 18:20:38 obrien Exp $
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