1# 2# To test: 3# POSIX: 4# - if no -r, \ is escape character 5# - \newline disappear 6# - \<IFS> -> don't break here 7# - \<anything-else> -> <anything-else> 8# - if -r, backslash is not special 9# - if stdin is tty and shell interactive 10# - prompt for continuation if \newline (prompt to stderr) 11# - a here-document isn't terminated after newline ???? 12# - remaining vars set to empty string (not null) 13# - check field splitting 14# - left over fields and their seperators assigned to last var 15# - exit status is normally 0 16# - exit status is > 0 on eof 17# - exit status > 0 on error 18# - signals interrupt reads 19# extra: 20# - can't change read-only variables 21# - error if var name bogus 22# - set -o allexport effects read 23# ksh: 24# x check default variable: REPLY 25# - check -p, -s, -u options 26# - check var?prompt stuff 27# - "echo a b | read x y" sets x,y in parent shell (at&t) 28# 29name: read-IFS-1 30description: 31 Simple test, default IFS 32stdin: 33 echo "A B " > IN 34 unset x y z 35 read x y z < IN 36 echo 1: "x[$x] y[$y] z[$z]" 37 echo 1a: ${z-z not set} 38 read x < IN 39 echo 2: "x[$x]" 40expected-stdout: 41 1: x[A] y[B] z[] 42 1a: 43 2: x[A B] 44--- 45 46name: read-ksh-1 47description: 48 If no var specified, REPLY is used 49stdin: 50 echo "abc" > IN 51 read < IN 52 echo "[$REPLY]"; 53expected-stdout: 54 [abc] 55--- 56 57