Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Making a log?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Making a log?
Authored by: Garin on Mar 13, '03 11:31:39AM

you could do something like:

echo `date; scriptname;` >> battery.log

If you do ">>" instead of ">" it will append to the end of the file rather than overwriting it. By enclosing two commands inside the backticks "``" these two commands will be executed, returning their output. Putting "echo" in front of it will dump out the results as text (otherwise the shell would try to execute the returned text).



[ Reply to This | # ]
Making a log?
Authored by: Garin on Mar 13, '03 11:35:58AM

Ah yes. The "echo" can be safely omitted when using csh, though it won't hurt to have it in there. With bash, you have to include it or it won't work.



[ Reply to This | # ]
Making a log?
Authored by: Garin on Mar 13, '03 11:41:32AM

*sigh* nevermind. Don't omit the "echo". You'll need the entire command as I originally posted it, in both csh and bash. Otherwise, either you won't get the timestamp in the log file, or the shell will try to execute the resulting text.



[ Reply to This | # ]