In a cron script I want to log CPU temperatures in the format
[datetime] temp
using date
and acpi -t
. How can I redirect (>>
) these two commands to a single line in the log file?
bashstdout
In a cron script I want to log CPU temperatures in the format
[datetime] temp
using date
and acpi -t
. How can I redirect (>>
) these two commands to a single line in the log file?
Best Answer
Try simply doing:
You might want to specify a compact date format to make your log file more easy to parse and to be independent of environment/locale settings (something like
$(date +"%Y%m%d %H%M%S")
for example).