I would like to do:
if not eof(stdin):
pass stdin to program
else:
do nothing
I have a feeling that it can be written fairly close to:
if test ! --is-eof - ; then
exec program
The problem I am trying to solve is that program reads from stdin but crashes if it gets no input. I do not have access to the source for program thus program cannot be changed. The binary input is bigger than the memory size so putting stdin to a file first is unacceptably slow. Processing all the input line-by-line in bash is unacceptably slow also.
The solution should ideally work under both csh and bash.