Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
|
a1a1a's comments
login
a1a1a
on Nov 5, 2022
|
parent
|
context
[–]
| on:
Shell script best practices, from a decade of scri...
One of my favorite shell script snippet is prepending timestamp to every output with the help of ts command of moreutils package, meanwhile write to log file at the same time:
https://unix.stackexchange.com/questions/26728/prepending-a-...
exec &> >( ts '[%Y-%m-%d.%H:%M:%S] ' | tee ${LOGFILENAME} )
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
exec &> >( ts '[%Y-%m-%d.%H:%M:%S] ' | tee ${LOGFILENAME} )