how to bail if stdin is empty

From: Jon Schull (schull_at_digitalgoods.com)
Date: 05/31/04


Date: 31 May 2004 06:35:34 -0700

I want to write a filter that will take input from files on the
command line and/or from stdin.

But if nothing has been piped to stdin, I don't want my program to
hang--I want it to do something else.

This is standard behavior for pipeable-programs I believe, but I can't
figure out how to do it...neither by reading from stdin nor by using
the fileinput module.

Thanks in advance!



Relevant Pages

  • Re: noobish dsadd computer script question
    ... I do not understand how the Active Directory Command ... Line Interface accepts information from a file using STDIN. ... Judging from the text in the book and the text in the DSADD help file, ...
    (microsoft.public.windows.server.scripting)
  • RE: What is the source of my input, file or STDIN?
    ... I could have been more explicit in my question to have stated that ... command line or if not invoked as the recipient of piped output. ... no command line args - switching to STDIN ... If input stream is not coming from STDIN, but a file, how can one ...
    (perl.beginners)
  • Re: Editable input from the console windows
    ... stdin, stdout, and stderror in relationship to pipe commands. ... I understand the fundamentals behind redirection. ... The exec command adds to the confusion as well. ... I learning the syntax and build upon a previously working script. ...
    (comp.unix.shell)
  • Re: noobish dsadd computer script question
    ... I do not understand how the Active Directory Command ... Line Interface accepts information from a file using STDIN. ... Judging from the text in the book and the text in the DSADD help file, ... as your file separates the names with carriage ...
    (microsoft.public.windows.server.scripting)
  • Re: noobish dsadd computer script question
    ... I do not understand how the Active Directory Command ... Line Interface accepts information from a file using STDIN. ... Judging from the text in the book and the text in the DSADD help file, ... as your file separates the names with carriage ...
    (microsoft.public.windows.server.scripting)