OSEC

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: Greg Wooledge (gregwooledge.org)
Date: Thu Sep 02 2004 - 20:52:05 CDT


Tomas (wishermyliu.m-1.lt) wrote:

> sendmail -bd && cd /var/log/ && gunzip maillog.6.gz && more maillog.6 |
mail
> -s Test mymail \

Han already gave you a working example, but here's why yours failed.

This command:

   more maillog.6 | mail -s Test mymail

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.

--
Greg Wooledge | "Truth belongs to everybody."
gregwooledge.org | - The Red Hot Chili Peppers
http://wooledge.org/~greg/ |

[demime 0.98d removed an attachment of type application/pgp-signature which had a name of signature.asc]