Created
February 1, 2019 05:46
-
-
Save treefitty/98626b864c846ad836cbd4cdbccb8247 to your computer and use it in GitHub Desktop.
Copies a file to another file with yesterday's date - used for a rudimentary todo history tracker when I work
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
# Get yesterday's date (different between Mac and Linux) | |
if [[ "$OSTYPE" == "darwin"* ]]; then | |
yesterday=`date -v-1d +%F` | |
else | |
yesterday=$(date -d "yesterday 13:00" +'%Y%m%d') | |
fi | |
# Construct the filename | |
dest=past-$yesterday.md | |
# Make sure the script hasn't already been run today | |
if [ -e $dest ]; then | |
echo "ERROR: todo already moved on" | |
else | |
cp -n _today.md $dest | |
fi | |
cd - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment