]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/regression/bin/sh/expansion/ifs2.0
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / regression / bin / sh / expansion / ifs2.0
1 # $FreeBSD$
2
3 failures=0
4 i=1
5 set -f
6 while [ "$i" -le 127 ]; do
7         # A different byte still in the range 1..127.
8         i2=$((i^2+(i==2)))
9         # Add a character to work around command substitution's removal of
10         # final newlines, then remove it again.
11         c=$(printf \\"$(printf %o@ "$i")")
12         c=${c%@}
13         c2=$(printf \\"$(printf %o@ "$i2")")
14         c2=${c2%@}
15         IFS=$c
16         set -- $c2$c$c2$c$c2
17         if [ "$#" -ne 3 ] || [ "$1" != "$c2" ] || [ "$2" != "$c2" ] ||
18             [ "$3" != "$c2" ]; then
19                 echo "Bad results for separator $i (word $i2)" >&2
20                 : $((failures += 1))
21         fi
22         i=$((i+1))
23 done
24 exit $((failures > 0))