freebsd-nq/bin/sh/tests/builtins/read1.0

27 lines
1.3 KiB
Plaintext
Raw Normal View History

2009-03-22 22:14:46 +00:00
# $FreeBSD$
set -e
echo "1 2 3" | { read a; echo "x${a}x"; }
echo "1 2 3" | { read a b; echo "x${a}x${b}x"; }
echo "1 2 3" | { read a b c; echo "x${a}x${b}x${c}x"; }
echo "1 2 3" | { read a b c d; echo "x${a}x${b}x${c}x${d}x"; }
echo " 1 2 3 " | { read a b c; echo "x${a}x${b}x${c}x"; }
2009-03-22 23:00:52 +00:00
echo " 1 2 3 " | { unset IFS; read a b c; echo "x${a}x${b}x${c}x"; }
2009-03-22 22:14:46 +00:00
echo " 1 2 3 " | { IFS=$(printf ' \t\n') read a b c; echo "x${a}x${b}x${c}x"; }
echo " 1 2 3 " | { IFS= read a b; echo "x${a}x${b}x"; }
echo " 1,2 3 " | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
echo ", 2 ,3" | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
echo " 1 ,,3" | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
echo " 1 , , 3" | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
echo " 1 ,2 3," | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
echo " 1 ,2 3,," | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
echo " 1,2 3 " | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
echo ", 2 ,3" | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
echo " 1 ,,3" | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
echo " 1 , , 3" | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
echo " 1 ,2 3," | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
echo " 1 ,2 3,," | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }