Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

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
You can’t perform that action at this time.