Skip to content

Instantly share code, notes, and snippets.

@initrd
Created September 28, 2018 19:32
Show Gist options
  • Save initrd/c7285c0db84fe5d7434b39a4b171b725 to your computer and use it in GitHub Desktop.
Save initrd/c7285c0db84fe5d7434b39a4b171b725 to your computer and use it in GitHub Desktop.
did - a function to keep track of little things/ktlo
# $ did Cleanup references to old hosts
# Tweaked from https://github.com/stevenschmatz/did/blob/master/did.sh
did() {
FILE_PATH=~/did.md
DATE=`date +"# %d %B %Y (%A)"`
# Try to see if date was already written to file
grep "$DATE" $FILE_PATH > /dev/null
status=$?
if test "$status" -eq 0
then
vim +'normal i' +'r!date +\%H:\%M' +"normal A $*" $FILE_PATH
else
vim +'r!date +"\# \%d \%B \%Y (\%A)"' +'r!date +\%H:\%M' +"normal A $*" $FILE_PATH
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment