xref: /freebsd/bin/sh/tests/errors/option-error.0 (revision 22cf89c938886d14f5796fc49f9f020c23ea8eaf)
1IFS=,
2
3SPECIAL="break abc,\
4	continue abc,\
5	.,
6	exit abc,
7	export -x,
8	readonly -x,
9	return abc,
10	set -z,
11	shift abc,
12	trap -y,
13	unset -y"
14
15UTILS="alias -y,\
16	cat -z,\
17	cd abc def,\
18	command break abc,\
19	expr 1 +,\
20	fc -z,\
21	getopts,\
22	hash -z,\
23	jobs -z,\
24	printf,\
25	pwd abc,\
26	read,\
27	test abc =,\
28	ulimit -z,\
29	umask -z,\
30	unalias -z,\
31	wait abc"
32
33# Special built-in utilities must abort on an option or operand error.
34set -- ${SPECIAL}
35for cmd in "$@"
36do
37	${SH} -c "${cmd}; exit 0" 2>/dev/null && exit 1
38done
39
40# Other utilities must not abort.
41set -- ${UTILS}
42for cmd in "$@"
43do
44	${SH} -c "${cmd}; exit 0" 2>/dev/null || exit 1
45done
46