Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- CHINACHU_DIR='/home/tao/Chinachu/data/'
- cd $CHINACHU_DIR
- titleRow=`git diff | grep '^-' | grep '"title"' | sed -e 's/-\s*"title":\s*"//' -e 's/",$//'`
- endDateRow=`git diff | grep '^-' | grep '"end"' | sed -e 's/-\s*"end":\s*//' -e 's/000,$//'`
- if [ "`echo $titleRow`" == "" ]; then
- echo "You DID NOT delete recorded file?"
- exit 1;
- fi
- titleRowCount=`echo $titleRow | wc -l`
- if [ "`echo $titleRowCount`" -ne 1 ]; then
- echo "You DID NOT deleted 1 recorded items?"
- echo "Please manual commit"
- echo ""
- echo $titleRow
- exit 1;
- fi
- if [ "`date +"%Y"`" -eq "`date -d @$endDateRow +"%Y"`" ]; then
- commitMsg="delete `date -d @$endDateRow +"%m/%d"` $titleRow"
- else
- commitMsg="delete `date -d @$endDateRow +"%Y/%m/%d"` $titleRow"
- fi
- echo $commitMsg
- echo "OK?"
- read input
- if [ "`echo $input`" == "OK" -o "`echo $input`" == "ok" -o "`echo $input`" == "y" ]; then
- git add recorded.json
- git commit -m "$commitMsg"
- git push
- else
- echo "cancel"
- fi
- exit 0;
Add Comment
Please, Sign In to add comment