Commit d7e9e4b9df6b3b9dab101921d6fd1cb357ef2cfa

Authored by Jean-François Rey
1 parent b427f103e1
Exists in master

update bugfix stderr

Showing 7 changed files with 34 additions and 31 deletions Side-by-side Diff

main_tools/ConfPass.sh
... ... @@ -36,7 +36,7 @@
36 36 then
37 37 . $CONFPASS_CONFIG_FILE
38 38 else
39   - echo "ERROR : Can't find configuration file $CONFPASS_CONFIG_FILE" > /dev/stderr
  39 + echo "ERROR : Can't find configuration file $CONFPASS_CONFIG_FILE" >&2
40 40 exit 1
41 41 fi
42 42  
... ... @@ -69,7 +69,7 @@
69 69 RERUN=1
70 70 ;;
71 71 :)
72   - echo "Option -$OPTARG requires an argument." > /dev/stderr
  72 + echo "Option -$OPTARG requires an argument." >&2
73 73 exit 1
74 74 ;;
75 75 \?)
main_tools/ExploitConfidencePass.sh
... ... @@ -77,7 +77,7 @@
77 77 RERUN=1
78 78 ;;
79 79 :)
80   - echo "Option -$OPTARG requires an argument." > /dev/stderr
  80 + echo "Option -$OPTARG requires an argument." >&2
81 81 exit 1
82 82 ;;
83 83 \?)
main_tools/FirstPass.sh
... ... @@ -35,8 +35,8 @@
35 35 then
36 36 . $FIRSTPASS_CONFIG_FILE
37 37 else
38   - echo "ERROR : Can't find configuration file $FIRSTPASS_CONFIG_FILE" > /dev/stderr
39   - echo "exit" > /dev/stderr
  38 + echo "ERROR : Can't find configuration file $FIRSTPASS_CONFIG_FILE" >&2
  39 + echo "exit" >&2
40 40 exit 1
41 41 fi
42 42  
... ... @@ -73,7 +73,7 @@
73 73 RERUN=1
74 74 ;;
75 75 :)
76   - echo "Option -$OPTARG requires an argument." > /dev/stderr
  76 + echo "Option -$OPTARG requires an argument." >&2
77 77 exit 1
78 78 ;;
79 79 \?)
80 80  
... ... @@ -228,12 +228,12 @@
228 228 if [ $? -eq 1 ]
229 229 then
230 230 print_log_file "$ERROFILE" "ERROR [$(date +'%d/%m/%y %H:%M:%S')] Creating PLP file : $PLP_FILE"
231   - echo "[${BASENAME}] ERROR : ${BASENAME} check $ERRORFILE file" > /dev/stderr
  231 + print_error "[${BASENAME}] -> exit, Check $ERRORFILE file"
232 232 exit 1
233 233 fi
234 234 fi
235 235  
236   -rm $OUTPUT_DIR_BASENAME/list.tmp
  236 +rm $OUTPUT_DIR_BASENAME/list.tmp 2> /dev/null
237 237  
238 238 #------------------------------#
239 239 # S/NS + SPEAKERS SEGMENTATION #
240 240  
241 241  
242 242  
243 243  
... ... @@ -358,22 +358,22 @@
358 358 done
359 359  
360 360 ## Check missing seg and log it
361   -if [ $CHECK -eq 1 ]
  361 +if [ "$CHECK" -eq 1 ]
362 362 then
363 363 ls $RES_DIR/*.seg | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp
364   - todo=$(cat ${OUTPUT_DIR_BASENAME}/plp.lst | wc -l)
365   - if [ $todo -eq 0 ]; then todo=1;fi
  364 + todo=$(cat ${OUTPUT_DIR_BASENAME}/plp.lst 2> /dev/null | wc -l)
  365 + if [ "$todo" -eq 0 ]; then todo=1;fi
366 366 notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l)))
367 367 pourcentage=$((($notdone*100)/$todo))
368 368  
369   - if [ $notdone -ne 0 ]
  369 + if [ "$notdone" -ne 0 ]
370 370 then
371   - print_error "[${BASENAME}] Check $ERRORFILE"
372   - print_log_file "$ERRORFILE" "ERROR : Segs not done ["
373   - diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $ERRORFILE
374   - print_log_file "$ERRORFILE" "] $pourcentage% $BASENAME"
  371 + print_error "[${BASENAME}] Check ${ERRORFILE}"
  372 + print_log_file "${ERRORFILE}" "ERROR : Segs not done ["
  373 + diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> ${ERRORFILE}
  374 + print_log_file "${ERRORFILE}" "] $pourcentage% $BASENAME"
375 375 else
376   - print_log_file "$LOGFILE" "P1 OK $BASENAME | $(date +'%d/%m/%y %H:%M:%S')"
  376 + print_log_file "$LOGFILE" "P1 OK ${BASENAME} | $(date +'%d/%m/%y %H:%M:%S')"
377 377 fi
378 378 rm ${OUTPUT_DIR_BASENAME}/.tmp
379 379 fi
main_tools/RecomposePass.sh
... ... @@ -59,7 +59,7 @@
59 59 VERBOSE=$OPTARG
60 60 ;;
61 61 :)
62   - echo "Option -$OPTARG requires an argument." > /dev/null
  62 + echo "Option -$OPTARG requires an argument." >&2
63 63 exit 1
64 64 ;;
65 65 \?)
main_tools/SecondPass.sh
... ... @@ -35,8 +35,8 @@
35 35 then
36 36 . $SECONDPASS_CONFIG_FILE
37 37 else
38   - echo "ERROR : Can't find configuration file $SECONDPASS_CONFIG_FILE" > /dev/stderr
39   - echo "exit" > /dev/stderr
  38 + echo "ERROR : Can't find configuration file $SECONDPASS_CONFIG_FILE" >&2
  39 + echo "exit" >&2
40 40 exit 1
41 41 fi
42 42  
43 43  
... ... @@ -73,11 +73,11 @@
73 73 RERUN=1
74 74 ;;
75 75 :)
76   - echo "Option -$OPTARG requires an argument." > /dev/stderr
  76 + echo "Option -$OPTARG requires an argument." >&2
77 77 exit 1
78 78 ;;
79 79 \?)
80   - echo "BAD USAGE : unknow opton -$OPTARG" > /dev/stderr
  80 + echo "BAD USAGE : unknow opton -$OPTARG" >&2
81 81 exit 1
82 82 ;;
83 83 esac
... ... @@ -232,7 +232,7 @@
232 232 if [ $RERUN -eq 0 ] || ( [ ! -e $HMM/$speaker.hmm ] || [ -z $HMM/$speaker.hmm ] )
233 233 then
234 234 print_info "[${BASENAME}] $SPEERAL_TOOLS/mllrmap $SPEERAL_AM/${MODS[$i]}.hmm -LR -b$LST/$speaker.lst -d$PLP_DIR_P1/ -t.plp -i3 -c.seg -o$HMM/$speaker.hmm -a$RES_DIR_P1/" 3
235   - $SPEERAL_TOOLS/mllrmap $SPEERAL_AM/${MODS[$i]}.hmm -LR -b$LST/$speaker.lst -d$PLP_DIR_P1/ -t.plp -i3 -c.seg -o$HMM/$speaker.hmm -a$RES_DIR_P1/
  235 + $SPEERAL_TOOLS/mllrmap $SPEERAL_AM/${MODS[$i]}.hmm -LR -b$LST/$speaker.lst -d$PLP_DIR_P1/ -t.plp -i3 -c.seg -o$HMM/$speaker.hmm -a$RES_DIR_P1/ 2> /dev/null
236 236 fi
237 237  
238 238 if [ $CHECK -eq 1 ] && ( [ ! -e $HMM/$speaker.hmm ] || [ -z $HMM/$speaker.hmm ] )
... ... @@ -250,7 +250,7 @@
250 250 if [ -s $HMM/$speaker.hmm ] && ( [ $RERUN -eq 0 ] || ( [ ! -e $HMM/$speaker.cls ] || [ -z $HMM/$speaker.cls ] ))
251 251 then
252 252 print_info "[${BASENAME}] $SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls" 3
253   - $SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls
  253 + $SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls 2> /dev/null
254 254 fi
255 255 if [ $CHECK -eq 1 ] && ( [ ! -e $HMM/$speaker.cls ] || [ -z $HMM/$speaker.cls ] )
256 256 then
... ... @@ -280,7 +280,7 @@
280 280 print_log_file $LOGFILE "WARN : Speeral number of output ERROR $LST/$speaker.lst"
281 281 ls $RES_DIR/*.seg | grep -e "$speaker" | sed -e "s|$RES_DIR\/||" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp
282 282 print_log_file $LOGFILE "Segs (and treil) not done :\n["
283   - diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp >> $LOGFILE
  283 + diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE
284 284 print_log_file $LOGFILE "] [$(date +'%d/%m/%y %H:%M:%S')]"
285 285 rm ${OUTPUT_DIR_BASENAME}/.tmp
286 286 #exit 1
main_tools/ThirdPass.sh
... ... @@ -70,7 +70,7 @@
70 70 RERUN=1
71 71 ;;
72 72 :)
73   - echo "Option -$OPTARG requires an argument." > /dev/null
  73 + echo "Option -$OPTARG requires an argument." >&2
74 74 exit 1
75 75 ;;
76 76 \?)
... ... @@ -219,7 +219,7 @@
219 219 print_log_file $LOGFILE "WARN : Speeral number of output ERROR $LST/$speaker.lst"
220 220 ls $RES_DIR/*.seg | grep -e "$speaker" | sed -e "s|$RES_DIR\/||" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp
221 221 print_log_file $LOGFILE "Segs (and treil) not done :\n["
222   - diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp >> $LOGFILE
  222 + diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE
223 223 print_log_file $LOGFILE "] [$(date +'%d/%m/%y %H:%M:%S')]"
224 224 rm ${OUTPUT_DIR_BASENAME}/.tmp
225 225 fi
tools/scripts/Tools.sh
... ... @@ -29,15 +29,15 @@
29 29 if [ $# -eq 3 ]
30 30 then
31 31 # print error
32   - if [ $1 -eq $ERROR ]; then echo -ne "###ERROR : $3\n" > /dev/stderr; return 0; fi
  32 + if [ $1 -eq $ERROR ]; then echo -ne " ###ERROR : $3\n" >&2 ; return 0; fi
33 33 # check verbose level
34 34 if [ $2 -le $VERBOSE ]
35 35 then
36 36 #for (( dec=1 ; $dec<$2 ; dec++ )); do echo -ne "\t"; done
37 37 # print warn
38   - if [ $1 = $WARN ]; then echo -ne "##WARNING : $3\n"; return 0; fi
  38 + if [ $1 = $WARN ]; then echo -ne " ##WARNING : $3\n"; return 0; fi
39 39 # default info
40   - echo -ne "#INFO : $3\n"
  40 + echo -ne " #INFO : $3\n"
41 41 fi
42 42 fi
43 43 }
... ... @@ -46,7 +46,10 @@
46 46 # - message : error message to print
47 47 function print_error()
48 48 {
49   - print_message $ERROR 3 "$1"
  49 + if [ $# -eq 1 ]
  50 + then
  51 + print_message $ERROR 3 "$1"
  52 + fi
50 53 }
51 54  
52 55 # print_warn(message,[level])