Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

redirection with option

Status
Not open for further replies.

suhaimi

Technical User
Aug 3, 2001
71
US
Hi all,
I would like to redirect the output in crontab, if and only if there's a string and remove the output file if the output is nothing. How I do that?

Rgds,
Suhaimi
 
You can do something like this :
[tt]
command > logfile ; [ -s logfile ] || rm logfile
[/tt]

Jean Pierre.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top