#! /bin/bash GREENSTONE_EMAIL=greenstone_team@cs.waikato.ac.nz # get rid of any old reports report=translation_status_report.txt if test -f $report; then rm -f $report fi filelisting=("macros/*.dm" "perllib/strings*.properties" "gli/classes/dictionary*.properties" "gli/help/" "gsinstaller/LanguagePack*.properties") date=`date +"%d-%m-%y"` echo "Translation status report for date: $date" >> $report echo "Checked in ${filelisting[@]}" >> $report echo "---------------------------------------------" >> $report # store backup of Internal Field Separator value, then set IFS to newline for splitting on newline IFS_BAK=$IFS # IFS='\n' # splits on all whitespace IFS=' ' num_modified=0 # in the lines returned from the diff, test for archives or newline # http://stackoverflow.com/questions/229551/string-contains-in-bash # http://stackoverflow.com/questions/10515964/counter-increment-in-bash-loop-not-working for file in ${filelisting[@]}; do status=`svn status $file` # "LINE: $file - status: $status" # if the file's svn status is modified, write the filename out to the report if [[ "$status" == *"M "* ]]; then #echo "$file has been modified: $status" echo $file >> $report ((num_modified++)) fi done # restore IFS IFS=$IFS_BAK IFS_BAK= if [[ $num_modified == 0 ]]; then echo "No files modified" >> $report else echo "" echo "The above files were modified ($num_modified number of files)." >> $report fi echo "---------------------------------------------" >> $report # if no files are modified, we don't send email, otherwise we do if [[ $num_modified != 0 ]]; then # echo "Files were modified. Sending email..." cat $report | mail -s 'TRANSLATION files on nzdl have been updated' $GREENSTONE_EMAIL fi