4 # Test the behavior of the shell with respect to variable and environment
19 a=3 b=4 $CHMOD $MODE $FN
21 # This should echo "3 4" according to Posix.2
27 # Assignment statements made when no words are left affect the shell's
29 a=5 b=6 $CHMOD c=7 $MODE d=8 $FN e=9
34 $CHMOD f=7 $MODE g=8 $FN h=9
40 # The temporary environment does not affect variable expansion, only the
41 # environment given to the command
48 HOME=/a/b/c /bin/echo $HOME
53 # This should echo /a/b/c
55 HOME=/a/b/c printenv HOME
59 # This should echo $HOME 9, NOT /a/b/c 9
62 HOME=/a/b/c /bin/echo $HOME c=9
66 # I claim the next two echo calls should give identical output.
67 # ksh agrees, the System V.3 sh does not
69 expect "/a/b/c 9 /a/b/c"
70 HOME=/a/b/c $ECHO a=$HOME c=9
73 expect "/a/b/c 9 /a/b/c"
74 HOME=/a/b/c a=$HOME c=9
78 # How do assignment statements affect subsequent assignments on the same
80 expect "/a/b/c /a/b/c"
84 # The system V.3 sh does this wrong; the last echo should output "1 1",
85 # but the system V.3 sh has it output "2 2". Posix.2 says the assignment
86 # statements are processed left-to-right. bash and ksh output the right
96 # just for completeness
105 /bin/true 2>/dev/null