Skip to content

Instantly share code, notes, and snippets.

@colby
Last active August 29, 2015 13:57
Show Gist options
  • Save colby/9648014 to your computer and use it in GitHub Desktop.
Save colby/9648014 to your computer and use it in GitHub Desktop.
A simple function for your bashrc to track time into a dotfile.
now() {
$file="$HOME/.now"
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