Created
December 15, 2017 19:16
-
-
Save smirzai/e644cb77accc11a482a7c6b01b53d3ef to your computer and use it in GitHub Desktop.
A small script to create my daily report file
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 | |
# this script checks the $base_path folder | |
# if there is no dailr report for today, it will create it and replace the %current-date% to current date | |
# in any case, it returns the file name which makes it suitable for a command like: | |
# emacs `dr` | |
read Y M D MM <<< $(date +'%Y %m %d') | |
base_path=~/Documents/dailyReports | |
file_name="dailyreport-$Y-$M-$D.adoc" | |
full_path="$base_path/$file_name" | |
template_full_path="$base_path/dailyReport-template.adoc" | |
if [ ! -e "$full_path" ]; then | |
sed "s/%current-date%/$Y-$M-$D/g" < "$template_full_path" > "$full_path" | |
fi | |
echo $full_path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment