The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: error log file
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 09-01-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Actually if something is competently written, its exit code should indicate whether or not it was successful; then you simply write


Code:
if something; then
  date +"%c: successfully did something"
else
  date +"%c: something failed"
fi >>/tmp/error.log

(Variations on output message formatting with date and the redirection flow simply to demonstrate that There Is More Than One Way To Do It.)