|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: A quick question about scripting
From: Matthew Clarke (clamat
telus.net)
Date: Fri Sep 03 2004 - 01:12:45 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
jeudi, le 2 septembre, 2004, Greg Wooledge nous a dit ceci:
> Tomas (wisher
myliu.m-1.lt) wrote:
>
> > sendmail -bd && cd /var/log/ && gunzip maillog.6.gz && more maillog.6 |
> mail
> > -s Test my
mail \
>
> Han already gave you a working example, but here's why yours failed.
>
> This command:
>
> more maillog.6 | mail -s Test my
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
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]