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