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!

logging

Status
Not open for further replies.

ozi403

Technical User
Apr 29, 2002
54
TR
How can I log my script?
 
ozi403,

I'm not sure what you are looking for, but if you wanted to output your errors and your output to log files you could use something like this:

test_script.sh 2> test_script.errors 1> test_script.log

If you want to append to the files so that you have historical logs, touch the files first and then type:

test_script.sh 2>> test_script.errors 1>> test_script.log

Hope this helps.

John
 
If it's for debug purpose, you may consider set -x also.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
In addition to the above if you want STDOUT and STDERR to log to the same file you can do

test_script.sh > test.log 2>&1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top