]> git.saurik.com Git - apple/shell_cmds.git/blob - sh/tests/builtins/read1.0
shell_cmds-216.60.1.tar.gz
[apple/shell_cmds.git] / sh / tests / builtins / read1.0
1 # $FreeBSD: head/bin/sh/tests/builtins/read1.0 190300 2009-03-22 23:00:52Z stefanf $
2 set -e
3
4 echo "1 2 3" | { read a; echo "x${a}x"; }
5 echo "1 2 3" | { read a b; echo "x${a}x${b}x"; }
6 echo "1 2 3" | { read a b c; echo "x${a}x${b}x${c}x"; }
7 echo "1 2 3" | { read a b c d; echo "x${a}x${b}x${c}x${d}x"; }
8
9 echo " 1 2 3 " | { read a b c; echo "x${a}x${b}x${c}x"; }
10 echo " 1 2 3 " | { unset IFS; read a b c; echo "x${a}x${b}x${c}x"; }
11 echo " 1 2 3 " | { IFS=$(printf ' \t\n') read a b c; echo "x${a}x${b}x${c}x"; }
12 echo " 1 2 3 " | { IFS= read a b; echo "x${a}x${b}x"; }
13
14 echo " 1,2 3 " | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
15 echo ", 2 ,3" | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
16 echo " 1 ,,3" | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
17 echo " 1 , , 3" | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
18 echo " 1 ,2 3," | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
19 echo " 1 ,2 3,," | { IFS=' ,' read a b c; echo "x${a}x${b}x${c}x"; }
20
21 echo " 1,2 3 " | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
22 echo ", 2 ,3" | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
23 echo " 1 ,,3" | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
24 echo " 1 , , 3" | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
25 echo " 1 ,2 3," | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
26 echo " 1 ,2 3,," | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }