xref: /freebsd/bin/sh/tests/builtins/read1.0 (revision 8f76bb7dad48538c6832c2fb466a433d2a3f8cd5)
1set -e
2
3echo "1 2 3"		| { read a; echo "x${a}x"; }
4echo "1 2 3"		| { read a b; echo "x${a}x${b}x"; }
5echo "1 2 3"		| { read a b c; echo "x${a}x${b}x${c}x"; }
6echo "1 2 3"		| { read a b c d; echo "x${a}x${b}x${c}x${d}x"; }
7
8echo "	1  2 3 "	| { read a b c; echo "x${a}x${b}x${c}x"; }
9echo "	1  2 3 "	| { unset IFS; read a b c; echo "x${a}x${b}x${c}x"; }
10echo "	1  2 3 "	| { IFS=$(printf ' \t\n') read a b c; echo "x${a}x${b}x${c}x"; }
11echo "	1  2 3 "	| { IFS= read a b; echo "x${a}x${b}x"; }
12
13echo " 1,2 3 "		| { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
14echo ", 2 ,3"		| { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
15echo " 1 ,,3"		| { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
16echo " 1 , , 3"		| { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
17echo " 1 ,2 3,"		| { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
18echo " 1 ,2 3,,"	| { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
19
20echo " 1,2 3 "		| { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
21echo ", 2 ,3"		| { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
22echo " 1 ,,3"		| { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
23echo " 1 , , 3"		| { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
24echo " 1 ,2 3,"		| { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
25echo " 1 ,2 3,,"	| { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
26