[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A quick question about scripting
- To: misc_(_at_)_openbsd_(_dot_)_org
- Subject: Re: A quick question about scripting
- From: Matthew Clarke <clamat_(_at_)_telus_(_dot_)_net>
- Date: Thu, 2 Sep 2004 23:12:45 -0700
- Mail-followup-to: misc_(_at_)_openbsd_(_dot_)_org
- Organization: Just me
jeudi, le 2 septembre, 2004, Greg Wooledge nous a dit ceci:
> Tomas (wisher_(_at_)_myliu_(_dot_)_m-1_(_dot_)_lt) wrote:
> > sendmail -bd && cd /var/log/ && gunzip maillog.6.gz && more maillog.6 |
> > -s Test my_(_at_)_mail \
> Han already gave you a working example, but here's why yours failed.
> This command:
> more maillog.6 | mail -s Test my_(_at_)_mail
> cannot work properly in a non-interactive script. more(1) displays a
> file a page at a time, pausing for user input at the end of each page.
> Since your script is not interactive, it'll never get user input, so
> it'll never go on to the second page.
> If you had used cat(1) instead, then it might have worked, although
> it's not the most efficient way of going about it.
Actually, more(1) and less(1) detect whether their stdout is a tty, and,
if not, they simply dump their output without pausing for user input.
For a successful technology, reality must take precedence over public
relations, for nature cannot be fooled.
-- Richard P. Feynman
Visit your host, monkey.org