Created
February 11, 2022 22:08
-
-
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
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
# /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