How can I detect if I reached EOF or HUP on a pipe or socket? bash gives 142 as return code for the read builtin: $ bash -c 'printf "abc" | while read -N 1 c ; res=$? ; echo $res ; (( res == 0 )) ; do true ; done ; read -n 1 -t 1 c ; res=$? ; echo $res' 0 0 0 1 142
ksh however gives 1 as return code for the read builtin, which is not different from the condition when we wait for more data: ksh -c 'printf "abc" | while read -N 1 c ; res=$? ; echo $res ; (( res == 0 )) ; do true ; done ; read -n 1 -t 1 c ; res=$? ; echo $res' 0 0 0 1 1 Wendy _______________________________________________ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users