Prepend timestamp to each line received from stdin
问题 Hi there I'm trying to create logs using bash but the time I'm getting is wrong. I'm running this in background. # log code here before executing curl script log "Yay I was started" curl https://example.com/process | sed "s/^/$(date -u) /" >> /path/to/logs.log & The time set after processing curl is the time it was executed not the time after I got the response. I need to get the time after the response. Here's the sample output (Wrong response) Fri Aug 21 01:43:12 UTC 2020 Yay I was started