Last active
July 26, 2018 10:48
-
-
Save mrpoptart/bca664a99534a001fc78d65bc1330b51 to your computer and use it in GitHub Desktop.
Today, bash_profile based task logger
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
# Create a log of what I did today at ~/.today | |
# Example: | |
# today I made a sandwich | |
# today I ate a sandwich | |
# cat ~/.today | |
# 2018-07-16 16:02:12 I made a sandwich | |
# 2018-07-16 15:59:28 I ate a sandwich | |
today(){ | |
# make sure the file exists | |
touch ~/.today | |
# get the current date/time | |
DATE=`date '+%Y-%m-%d %H:%M:%S'` | |
# take all of the arguments to this function and assemble them with spaces | |
str="$*" | |
# prepend the content to the file | |
echo -e "$DATE $str\n$(cat ~/.today)" > ~/.today | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice! I'm new to bash scripts, how do you get this to run? Do I source this file from bash_profile?