Why is 'more' giving the 'next file' prompt?

P E Smee exspes at bath.ac.uk
Fri May 4 02:07:44 AEST 1990


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 at bristol.ac.uk - ..!uunet!ukc!bsmail!p.smee - Tel +44 272 303132



More information about the Comp.unix.wizards mailing list