1#!/bin/bash 2 3print_help() 4{ 5 echo "usage: $0 <warning file>" 6 exit 1; 7} 8 9set_title() 10{ 11 echo -ne "\033]0;$*\007" 12 echo ======================================== 13 echo $* 14 echo ---------------------------------------- 15} 16 17cmd_help() 18{ 19 echo "n - skips to next message" 20 echo "f - skips to next file" 21 echo "? - print this message again" 22} 23 24save_thoughts() 25{ 26 echo "************" 27 echo $sm_err 28 echo -n "What do you think?: " 29 read ans 30 if echo $ans | grep ^$ > /dev/null ; then 31 return 32 fi 33 34 #store the result 35 echo $sm_err >> summary 36 echo $ans >> summary 37 echo ========== >> summary 38} 39 40if [ "$1" = "--new" ] ; then 41 shift 42 NEW=Y 43fi 44 45file=$1 46if [ "$file" = "" ] ; then 47 if [ -e err-list ] ; then 48 file="err-list" 49 else 50 print_help 51 fi 52fi 53 54TXT=$(cat $file | uniq -f 2) 55 56IFS=' 57' 58for sm_err in $TXT ; do 59 file=$(echo $sm_err | cut -d ':' -f 1) 60 line=$(echo $sm_err | cut -d ' ' -f 1 | cut -d ':' -f 2) 61 62 if [ "$file" = "$skip_file" ] ; then 63 continue 64 fi 65 skip_file="" 66 67 last=$(echo $sm_err | cut -d ' ' -f 2-) 68 last=$(echo $last | sed -e 's/line .*//') 69 70 if [ "$NEW" = "Y" ] ; then 71 if grep -F "$last" *summary* > /dev/null ; then 72 echo "skipping $sm_err" 73 continue 74 fi 75 fi 76 77 set_title $sm_err 78 79 #grep -A1 "$file $line" *summary* 2> /dev/null 80 grep -A1 -F "$last" *summary* 2> /dev/null 81 82 ans="?" 83 while echo $ans | grep '?' > /dev/null ; do 84 echo -n "[? for help]: " 85 read ans 86 if echo $ans | grep n > /dev/null ; then 87 continue 2 88 fi 89 if echo $ans | grep f > /dev/null ; then 90 skip_file=$file 91 continue 2 92 fi 93 if echo $ans | grep '?' > /dev/null ; then 94 cmd_help 95 fi 96 done 97 98 # I have this in my .vimrc 99 # map <C-j> :! echo $sm_err<CR> 100 export sm_err 101 102 vim $file +${line} 103 104 save_thoughts 105done 106IFS= 107