summary refs log tree commit diff
path: root/bin/cash/tests/builtins/read1.0
blob: 753613d06368ab12a61531ec6c266d88b40bf366 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# $FreeBSD: releng/12.0/bin/sh/tests/builtins/read1.0 190300 2009-03-22 23:00:52Z stefanf $
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"; }
echo "	1  2 3 "	| { unset IFS; read a b c; echo "x${a}x${b}x${c}x"; }
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"; }