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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a log file

Status
Not open for further replies.

da644

Programmer
May 21, 2001
159
GB
Hi Everyone.

I have a small shell script that performs some tasks each night and I would like to write the output to a file to create a log of the activity so that I can verify it is working ok and log and errors. However, if I use '> /etc/log/test.log' after the command it simply over writes the file each time, which is no good, how to I get it to append to the end of the file instead. Are there some commands for writing to files?

Thanks for any help.

Best Regards

Andrew.
 
Hi. Use >> rather than >

This appends to the file rather than overwriting it. Cheers.
 
Simply use
Code:
 2>&1 >>/etc/log/test.log
, provided you use sh,ksh,bash or any bourne shell compatible.

Hope This Help
PH.
 
Excellent. Thanks.

Best Regards

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top