Re: How to enforce the "more" command



Thanks Chris.
I wondered if there is any other command to pause the output.
"pg" is not working either.

James

Chris F.A. Johnson wrote:
On 2006-05-23, James wrote:
Chris F.A. Johnson wrote:
On 2006-05-23, James wrote:
ksh on AIX 5.2

I have a script, test.sh, which contains
ls -l /tmp | more
"more" works well. However, once I pipe another script's
ouput to test.sh, e.g. ./anotherscript.sh | ./test.sh
"more" is not working anymore. The contents of /tmp
was displayed without being paged.

I don't know why it is not being paged; it is on my system.

However, whatever it's behaviour. there is no point to piping
anything to test.sh as it doesn't read its stdin. You will always
see the contents of /tmp.

I tried -c and -l option of "more" but no luck. Is there any
"-p Subcommand" helpful here? Any hints?

[please don't top post]

sorry, I did not explain it clearly, what I did is
test.sh contains more than just one line of "ls"

When I do
tee -a /tmp/logfile | ./test.sh | tee -a /tmp/logfile
to log both input and output, "more" is not
functioning.

Since you are piping the outpus of test.sh to another command,
neither its stdin nor its stdout is connected to a terminal,
therefore more does not pause.

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence

.



Relevant Pages

  • 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: Providing STDIN to a PIPEd call to perl
    ... script using STDIN on the command line? ... but I cannot use the keyboard to provide the STDIN. ... and exit the while loop when EOF is reached. ...
    (perl.beginners)
  • Re: Printing quota ?
    ... > LPRng calls the script with user information as command line ... > options and the document on STDIN. ... The script determines the user ...
    (freebsd-questions)
  • Re: Providing STDIN to a PIPEd call to perl
    ... script using STDIN on the command line? ... but I cannot use the keyboard to provide the STDIN. ... I have a SAS program that processes many thousands of files. ...
    (perl.beginners)
  • Re: calling gnuplot with C++
    ... 'pause -1' waits until more input is available. ... But if you are running from a script then the next line is available ... At least not on those platforms where gnuplot runs in an ... This tends to break the "pause -1" command, because the next line in the ...
    (comp.graphics.apps.gnuplot)