xref: /freebsd/bin/sh/tests/builtins/var-assign2.0 (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
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# With 'command', variable assignments do not affect the shell environment.
43
44set -- ${SPECIAL}
45for cmd in "$@"
46do
47	${SH} -c "VAR=0; VAR=1 command ${cmd}; exit \${VAR}" >/dev/null 2>&1
48done
49
50set -- ${UTILS}
51for cmd in "$@"
52do
53	${SH} -c "VAR=0; VAR=1 command ${cmd}; exit \${VAR}" >/dev/null 2>&1
54done
55