Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!dcl-cs!gdt!exspes From: exspes@bath.ac.uk (P E Smee) Newsgroups: comp.unix.wizards Subject: Why is 'more' giving the 'next file' prompt? Message-ID: <1990May3.160744.25250@bath.ac.uk> Date: 3 May 90 16:07:44 GMT Organization: University of Bristol c/o University of Bath Lines: 26 Ok, folks, here's one which my boss asked for an answer to the other day, and I don't see the answer. The context is (4 different variants of) 4.3BSD (on 4 different platforms). Make yourself a small text file, say 'fred'. Then try the command line: cat fred | csh -c 'cat >tempxxx ; more tempxxx' Before 'more' puts anything out, it gives the 'Next file (tempxxx):' prompt. Why does it think tempxxx is the second file? What's the first? (This is a test case synthesized from a real -- and useful -- example, found while working with a subsystem which allows you to predefine 'command sets' to pipe stuff through. The first 'cat' is simply imitating this subsystem, i.e. being an stdout producer; so in the real case only the stuff after the '|' is interesting. The purpose of piping through 'cat' into a temp file and then giving that to 'more' as an arg is that in that case 'more' will allow you to move backwards; while if 'more' is processing stdin you can only go frontwards. In the context of the original, the shell invocation is needed in order to allow the (second) 'cat' and the 'more' to be joined with ';' rather than being '|'ed together. Using 'sh' doesn't seem to change things.) -- Paul Smee, Computing Service, University of Bristol, Bristol BS8 1UD, UK P.Smee@bristol.ac.uk - ..!uunet!ukc!bsmail!p.smee - Tel +44 272 303132