In a cron script I want to log CPU temperatures in the format[datetime] tempusing date and acpi -t. How can I redirect (>>) these two commands to a single line in the log file?
Merge two command results to one line when redirecting stdout
bash;stdout
Try simply doing:echo $(date) $(acpi -t) >> your_log_fileYou 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).