xref: /freebsd/bin/sh/tests/expansion/redir1.0 (revision f173c2b77e0287807852bb7ba982643f33bdf8a0)
1# $FreeBSD$
2
3bad=0
4for i in 0 1 2 3; do
5	for j in 0 1 2 3 4 5 6 7; do
6		for k in 0 1 2 3 4 5 6 7; do
7			case $i$j$k in
8			000) continue ;;
9			esac
10			set -- "$(printf \\$i$j$k@)"
11			set -- "${1%@}"
12			ff=
13			for f in /dev/null /dev/zero /; do
14				if [ -e "$f" ] && [ ! -e "$f$1" ]; then
15					ff=$f
16				fi
17			done
18			[ -n "$ff" ] || continue
19			if { true <$ff$1; } 2>/dev/null; then
20				echo "Bad: $i$j$k ($ff)" >&2
21				: $((bad += 1))
22			fi
23		done
24	done
25done
26exit $((bad ? 2 : 0))
27