In my .bash_profile I have script -a -t 0 session.log which automatically records all terminal input/output into the session.log file. I know this command comes with an optional flag to record the time differences in another file but I was wondering if there was another way to prefix the session.log lines with a timestamp.Can I pipe the writes to a different shell function before writing it to session.log? Something like this script -a >(add_timestamps.sh >> session.log) (does not work)
add timestamps to recorded session via script command
terminal;logs;timestamps;typescript
There is probably only one thing missing from your example, the option -f to flush the write each time. script -f >(while read;do date;echo $REPLY;done >>session.log)