Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • Thanks @Bruce Ediger for the answer. I did not follow some of the points made in the 2nd paragraph. You said "Coding a special case in cat does not make sense..." Is the special case the tty input? Commented Jan 8, 2015 at 1:36
  • 1
    @boxofchalk1 - for cat, the special case would be checking if file descriptor 0 represents a TTY device, and exiting if it is. If the cat program doesn't find any file names in argv[], it just reads file descriptor 0 until end-of-file. Commented Jan 8, 2015 at 14:37
  • I agree with this answer. You can do whatever you want tech wise, but paging stdin doesn't make design sense so you detect it and call it an error. Cat is used in a variety of places where cat stdin makes sense. '(echo header; cat -;echo footer) > /tmp/somefile.txt'. I've also used cat > /proc/whatever Commented Jan 20, 2015 at 1:56