I want to output two commands to a file. I want the exact time (date) AND temperature (sensors) to go to file every 5 minutes. I know how to output one command to a file, but two? How to write such script?
feedback
|
|
Something like this? (In a loop, cron, or whatever you're currently using.)
| |||||
feedback
|
|
Group all commands in parenthesis, because that will execute them in a sub-shell which you easily can redirect the output from:
| |||
|
feedback
|
|
If I understand your question right--you want to output two values to the same file--then this might be what you are looking for:
| |||
|
feedback
|
|
Maybe I am misunderstanding the question, but it looks like all the answers are appending to one file. I read your question to be that you want the same output in 2 files. If that was what you are looking for, tee is a way to accomplish that:
| |||
|
feedback
|
|
Refering to hlovdal post, you can set a cron like this:
| |||||
feedback
|