]> git.saurik.com Git - apple/shell_cmds.git/blame - sh/tests/expansion/ifs2.0
shell_cmds-216.60.1.tar.gz
[apple/shell_cmds.git] / sh / tests / expansion / ifs2.0
CommitLineData
deb63bfb 1# $FreeBSD: head/bin/sh/tests/expansion/ifs2.0 211341 2010-08-15 17:14:05Z jilles $
71aad674
A
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))