Skip to content

Instantly share code, notes, and snippets.

@ZeroDeth
Forked from EntropyWorks/timestamp.sh
Created January 10, 2018 11:49
Show Gist options
  • Select an option

  • Save ZeroDeth/aef196db6272ab72b66fc81573fd4d01 to your computer and use it in GitHub Desktop.

Select an option

Save ZeroDeth/aef196db6272ab72b66fc81573fd4d01 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