Skip to content

Instantly share code, notes, and snippets.

@Landrash
Created February 11, 2022 22:08
Show Gist options
  • Save Landrash/03de37d74295933b5416e62e9129906b to your computer and use it in GitHub Desktop.
Save Landrash/03de37d74295933b5416e62e9129906b to your computer and use it in GitHub Desktop.
Simple notetaking script that creates a note in a folder with the current date and adds a timestamp when it's launched. Inspired by @maccan
# /bin/bash
##########################################################
### Simple notetaking script ###
### Creates notes in a folder based on date ###
### and add a timestamp into the file when it launched ###
##########################################################
#Variables
EDITOR="nano"
NOTES_FOLDER="/home/$(whoami)/notes"
TIME=$(date +"%R")
DATE=$(date +"%Y-%m-%d")
FILE="$NOTES_FOLDER"/note-"$DATE".md
if [ -f "$FILE" ]; then
#Create Timestamp in note and open editor
echo -e "##$TIME:">>"$FILE"
echo -e "---\n">>"$FILE"
else
echo -e "#Noteringar från $DATE av $(whoami)">>"$FILE"
echo -e "---\n">>"$FILE"
echo -e "##$TIME:">>"$FILE"
echo -e "---\n">>"$FILE"
fi
# Open note in editor
"$EDITOR" "$FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment