Skip to content

Instantly share code, notes, and snippets.

@kyleterry
Forked from colby/Time tracking bash function
Last active August 29, 2015 13:57
Show Gist options
  • Save kyleterry/9674123 to your computer and use it in GitHub Desktop.
Save kyleterry/9674123 to your computer and use it in GitHub Desktop.
now() {
file="$HOME/.now"
if [ ! -f $file ]; then
touch $file
fi
if [[ -z $@ ]]; then
today="$(date "+%Y-%m-%d")"
grep --color=never $today $file | cut -d' ' -f2-
else
stamp="$(date "+%Y-%m-%d %H:%M:%S")"
echo $stamp - "$@" >> $file
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment