Detect presence of stdin contents in Bourne Shell

Posted by l0b0 on Stack Overflow See other posts from Stack Overflow or by l0b0
Published on 2010-03-16T17:43:44Z Indexed on 2010/03/16 18:01 UTC
Read the original article Hit count: 384

Filed under:

I'm writing a Bourne Shell script that may or may not receive input from stdin (as in foo.sh < test.txt, non-interactively). How do I check whether there is anything on stdin, to avoid halting on while read -r line...?

© Stack Overflow or respective owner

Related posts about bourne-shell