Created
July 31, 2020 17:21
-
-
Save ferminhg/c2229a3038eca79c3746d2ac0ece7145 to your computer and use it in GitHub Desktop.
Shell script to create a daily file `20200731.md`
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 | |
# ./create_daily.sh [--tomorrow] | |
# Flags: (--tomorrow) to create the file for tomorrow | |
if [ "$1" == "--tomorrow" ] ; then | |
# not need to be initializaded | |
DATE_PARAM="-v +1d" | |
fi | |
DAILY_PATH=$(dirname "$0") | |
DATE_FILE=$(date $DATE_PARAM '+%Y%m%d') | |
DAILY_FILE=$DAILY_PATH/$DATE_FILE.md | |
if [ -f "$DAILY_FILE" ]; then | |
exit | |
fi | |
DATE_TITLE=$(date $DATE_PARAM '+%Y-%m-%d') | |
cat > $DAILY_FILE << EOF | |
# $DATE_TITLE | |
## TODO | |
- [ ] task1 | |
- [ ] task2 | |
- [ ] task3 | |
## Notes | |
## Links | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment