Skip to content

Instantly share code, notes, and snippets.

@EntropyWorks
Created November 22, 2017 18:25
Show Gist options
  • Save EntropyWorks/fba55771075d5ab0a0cda7338c3befee to your computer and use it in GitHub Desktop.
Save EntropyWorks/fba55771075d5ab0a0cda7338c3befee to your computer and use it in GitHub Desktop.
Timestamp output
# Not originally created by me btw.
# Handy python timestamp trick
function p-timestamp() {
python -c 'import sys,time;sys.stdout.write("".join\
(( " ".join((time.strftime("[%Y-%m-%d %H:%M:%S]", time.localtime())\
, line)) for line in sys.stdin )))'
}
## Custom echo that adds a timestamp
function echo() {
echo $1 | p-timestamp
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment