In bash/ksh can we add timestamp to STDERR redirection?
E.g. myscript.sh 2> error.log
I want to get a timestamp written on the log too.
The program ts from the moreutils package pipes standard input to standard output, and prefixes each line with a timestamp.
ts
To prefix stdout lines: command | ts To prefix both stdout and stderr: command 2>&1 | ts
command | ts
command 2>&1 | ts