diff --git a/main_tools/ConfPass.sh b/main_tools/ConfPass.sh index 679b348..3d79e20 100755 --- a/main_tools/ConfPass.sh +++ b/main_tools/ConfPass.sh @@ -36,7 +36,7 @@ if [ -e $CONFPASS_CONFIG_FILE ] then . $CONFPASS_CONFIG_FILE else - echo "ERROR : Can't find configuration file $CONFPASS_CONFIG_FILE" > /dev/stderr + echo "ERROR : Can't find configuration file $CONFPASS_CONFIG_FILE" >&2 exit 1 fi @@ -69,7 +69,7 @@ do RERUN=1 ;; :) - echo "Option -$OPTARG requires an argument." > /dev/stderr + echo "Option -$OPTARG requires an argument." >&2 exit 1 ;; \?) diff --git a/main_tools/ExploitConfidencePass.sh b/main_tools/ExploitConfidencePass.sh index c01c8e9..a6d71cf 100755 --- a/main_tools/ExploitConfidencePass.sh +++ b/main_tools/ExploitConfidencePass.sh @@ -77,7 +77,7 @@ do RERUN=1 ;; :) - echo "Option -$OPTARG requires an argument." > /dev/stderr + echo "Option -$OPTARG requires an argument." >&2 exit 1 ;; \?) diff --git a/main_tools/FirstPass.sh b/main_tools/FirstPass.sh index 673c3b0..436ac87 100755 --- a/main_tools/FirstPass.sh +++ b/main_tools/FirstPass.sh @@ -35,8 +35,8 @@ if [ -e $FIRSTPASS_CONFIG_FILE ] then . $FIRSTPASS_CONFIG_FILE else - echo "ERROR : Can't find configuration file $FIRSTPASS_CONFIG_FILE" > /dev/stderr - echo "exit" > /dev/stderr + echo "ERROR : Can't find configuration file $FIRSTPASS_CONFIG_FILE" >&2 + echo "exit" >&2 exit 1 fi @@ -73,7 +73,7 @@ do RERUN=1 ;; :) - echo "Option -$OPTARG requires an argument." > /dev/stderr + echo "Option -$OPTARG requires an argument." >&2 exit 1 ;; \?) @@ -228,12 +228,12 @@ then if [ $? -eq 1 ] then print_log_file "$ERROFILE" "ERROR [$(date +'%d/%m/%y %H:%M:%S')] Creating PLP file : $PLP_FILE" - echo "[${BASENAME}] ERROR : ${BASENAME} check $ERRORFILE file" > /dev/stderr + print_error "[${BASENAME}] -> exit, Check $ERRORFILE file" exit 1 fi fi -rm $OUTPUT_DIR_BASENAME/list.tmp +rm $OUTPUT_DIR_BASENAME/list.tmp 2> /dev/null #------------------------------# # S/NS + SPEAKERS SEGMENTATION # @@ -358,22 +358,22 @@ do done ## Check missing seg and log it -if [ $CHECK -eq 1 ] +if [ "$CHECK" -eq 1 ] then ls $RES_DIR/*.seg | sed -e "s|$RES_DIR\/||g" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp - todo=$(cat ${OUTPUT_DIR_BASENAME}/plp.lst | wc -l) - if [ $todo -eq 0 ]; then todo=1;fi + todo=$(cat ${OUTPUT_DIR_BASENAME}/plp.lst 2> /dev/null | wc -l) + if [ "$todo" -eq 0 ]; then todo=1;fi notdone=$(($todo - $(cat ${OUTPUT_DIR_BASENAME}/.tmp | wc -l))) pourcentage=$((($notdone*100)/$todo)) - if [ $notdone -ne 0 ] + if [ "$notdone" -ne 0 ] then - print_error "[${BASENAME}] Check $ERRORFILE" - print_log_file "$ERRORFILE" "ERROR : Segs not done [" - diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $ERRORFILE - print_log_file "$ERRORFILE" "] $pourcentage% $BASENAME" + print_error "[${BASENAME}] Check ${ERRORFILE}" + print_log_file "${ERRORFILE}" "ERROR : Segs not done [" + diff ${OUTPUT_DIR_BASENAME}/plp.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> ${ERRORFILE} + print_log_file "${ERRORFILE}" "] $pourcentage% $BASENAME" else - print_log_file "$LOGFILE" "P1 OK $BASENAME | $(date +'%d/%m/%y %H:%M:%S')" + print_log_file "$LOGFILE" "P1 OK ${BASENAME} | $(date +'%d/%m/%y %H:%M:%S')" fi rm ${OUTPUT_DIR_BASENAME}/.tmp fi diff --git a/main_tools/RecomposePass.sh b/main_tools/RecomposePass.sh index 530e7e5..b073736 100755 --- a/main_tools/RecomposePass.sh +++ b/main_tools/RecomposePass.sh @@ -59,7 +59,7 @@ do VERBOSE=$OPTARG ;; :) - echo "Option -$OPTARG requires an argument." > /dev/null + echo "Option -$OPTARG requires an argument." >&2 exit 1 ;; \?) diff --git a/main_tools/SecondPass.sh b/main_tools/SecondPass.sh index 869a39f..2f9ae1e 100755 --- a/main_tools/SecondPass.sh +++ b/main_tools/SecondPass.sh @@ -35,8 +35,8 @@ if [ -e $SECONDPASS_CONFIG_FILE ] then . $SECONDPASS_CONFIG_FILE else - echo "ERROR : Can't find configuration file $SECONDPASS_CONFIG_FILE" > /dev/stderr - echo "exit" > /dev/stderr + echo "ERROR : Can't find configuration file $SECONDPASS_CONFIG_FILE" >&2 + echo "exit" >&2 exit 1 fi @@ -73,11 +73,11 @@ do RERUN=1 ;; :) - echo "Option -$OPTARG requires an argument." > /dev/stderr + echo "Option -$OPTARG requires an argument." >&2 exit 1 ;; \?) - echo "BAD USAGE : unknow opton -$OPTARG" > /dev/stderr + echo "BAD USAGE : unknow opton -$OPTARG" >&2 exit 1 ;; esac @@ -232,7 +232,7 @@ do if [ $RERUN -eq 0 ] || ( [ ! -e $HMM/$speaker.hmm ] || [ -z $HMM/$speaker.hmm ] ) then 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 - $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/ + $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 fi if [ $CHECK -eq 1 ] && ( [ ! -e $HMM/$speaker.hmm ] || [ -z $HMM/$speaker.hmm ] ) @@ -250,7 +250,7 @@ do if [ -s $HMM/$speaker.hmm ] && ( [ $RERUN -eq 0 ] || ( [ ! -e $HMM/$speaker.cls ] || [ -z $HMM/$speaker.cls ] )) then print_info "[${BASENAME}] $SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls" 3 - $SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls + $SPEERAL_TOOLS/gclust_pdf $HMM/$speaker.hmm $HMM/$speaker.cls -i $SPEERAL_AM/${MODS[$i]}.cls 2> /dev/null fi if [ $CHECK -eq 1 ] && ( [ ! -e $HMM/$speaker.cls ] || [ -z $HMM/$speaker.cls ] ) then @@ -280,7 +280,7 @@ do print_log_file $LOGFILE "WARN : Speeral number of output ERROR $LST/$speaker.lst" ls $RES_DIR/*.seg | grep -e "$speaker" | sed -e "s|$RES_DIR\/||" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp print_log_file $LOGFILE "Segs (and treil) not done :\n[" - diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp >> $LOGFILE + diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE print_log_file $LOGFILE "] [$(date +'%d/%m/%y %H:%M:%S')]" rm ${OUTPUT_DIR_BASENAME}/.tmp #exit 1 diff --git a/main_tools/ThirdPass.sh b/main_tools/ThirdPass.sh index 77fa438..8d724ba 100755 --- a/main_tools/ThirdPass.sh +++ b/main_tools/ThirdPass.sh @@ -70,7 +70,7 @@ do RERUN=1 ;; :) - echo "Option -$OPTARG requires an argument." > /dev/null + echo "Option -$OPTARG requires an argument." >&2 exit 1 ;; \?) @@ -219,7 +219,7 @@ do print_log_file $LOGFILE "WARN : Speeral number of output ERROR $LST/$speaker.lst" ls $RES_DIR/*.seg | grep -e "$speaker" | sed -e "s|$RES_DIR\/||" | sed -e 's/\.seg//' | sort > ${OUTPUT_DIR_BASENAME}/.tmp print_log_file $LOGFILE "Segs (and treil) not done :\n[" - diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp >> $LOGFILE + diff $LST/$speaker.lst ${OUTPUT_DIR_BASENAME}/.tmp | grep -e "^< " | sed -e "s/< //" >> $LOGFILE print_log_file $LOGFILE "] [$(date +'%d/%m/%y %H:%M:%S')]" rm ${OUTPUT_DIR_BASENAME}/.tmp fi diff --git a/tools/scripts/Tools.sh b/tools/scripts/Tools.sh index daf034b..0640c53 100755 --- a/tools/scripts/Tools.sh +++ b/tools/scripts/Tools.sh @@ -29,15 +29,15 @@ function print_message() if [ $# -eq 3 ] then # print error - if [ $1 -eq $ERROR ]; then echo -ne "###ERROR : $3\n" > /dev/stderr; return 0; fi + if [ $1 -eq $ERROR ]; then echo -ne " ###ERROR : $3\n" >&2 ; return 0; fi # check verbose level if [ $2 -le $VERBOSE ] then #for (( dec=1 ; $dec<$2 ; dec++ )); do echo -ne "\t"; done # print warn - if [ $1 = $WARN ]; then echo -ne "##WARNING : $3\n"; return 0; fi + if [ $1 = $WARN ]; then echo -ne " ##WARNING : $3\n"; return 0; fi # default info - echo -ne "#INFO : $3\n" + echo -ne " #INFO : $3\n" fi fi } @@ -46,7 +46,10 @@ function print_message() # - message : error message to print function print_error() { - print_message $ERROR 3 "$1" + if [ $# -eq 1 ] + then + print_message $ERROR 3 "$1" + fi } # print_warn(message,[level])