Skip to content

Instantly share code, notes, and snippets.

@mrpoptart
Last active July 26, 2018 10:48
Show Gist options
  • Save mrpoptart/bca664a99534a001fc78d65bc1330b51 to your computer and use it in GitHub Desktop.
Save mrpoptart/bca664a99534a001fc78d65bc1330b51 to your computer and use it in GitHub Desktop.
Today, bash_profile based task logger
# 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
}
@theptrk
Copy link

theptrk commented Jul 22, 2018

Nice! I'm new to bash scripts, how do you get this to run? Do I source this file from bash_profile?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment