xref: /freebsd/bin/sh/tests/builtins/var-assign.0 (revision 2008043f386721d58158e37e0d7e50df8095942d)
1IFS=,
2
3SPECIAL="break,\
4	:,\
5	continue,\
6	. /dev/null,
7	eval,
8	exec,
9	export -p,
10	readonly -p,
11	set,
12	shift 0,
13	times,
14	trap,
15	unset foo"
16
17UTILS="alias,\
18	bg,\
19	bind,\
20	cd,\
21	command echo,\
22	echo,\
23	false,\
24	fc -l,\
25	fg,\
26	getopts a var,\
27	hash,\
28	jobs,\
29	printf a,\
30	pwd,\
31	read var < /dev/null,\
32	test,\
33	true,\
34	type ls,\
35	ulimit,\
36	umask,\
37	unalias -a,\
38	wait"
39
40set -e
41
42# For special built-ins variable assignments affect the shell environment.
43set -- ${SPECIAL}
44for cmd in "$@"
45do
46	${SH} -c "VAR=1; VAR=0 ${cmd}; exit \${VAR}" >/dev/null 2>&1
47done
48
49# For other built-ins and utilities they do not.
50set -- ${UTILS}
51for cmd in "$@"
52do
53	${SH} -c "VAR=0; VAR=1 ${cmd}; exit \${VAR}" >/dev/null 2>&1
54done
55