Created
September 28, 2018 19:32
-
-
Save initrd/c7285c0db84fe5d7434b39a4b171b725 to your computer and use it in GitHub Desktop.
did - a function to keep track of little things/ktlo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $ 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