xref: /freebsd/bin/sh/tests/expansion/ifs2.0 (revision 6be3386466ab79a84b48429ae66244f21526d3df)
1# $FreeBSD$
2
3failures=0
4i=1
5set -f
6while [ "$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))
23done
24exit $((failures > 0))
25