Skip to content

Instantly share code, notes, and snippets.

@smirzai
Created December 15, 2017 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smirzai/e644cb77accc11a482a7c6b01b53d3ef to your computer and use it in GitHub Desktop.
Save smirzai/e644cb77accc11a482a7c6b01b53d3ef to your computer and use it in GitHub Desktop.
A small script to create my daily report file
#!/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