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