CheckConfPass.sh 1.14 KB
#!/bin/bash
 
#################################################
# File :    CheckConfPass.sh                    #
# Brief :   Check Conf Pass                     #
# Author :  Jean-François Rey                   #
# Version : 1.0                                 #
# Date :    17/06/13                            #
#################################################
 
# configuration file
. "$OTMEDIA_HOME/cfg/ConfPass.cfg"

# check_conf_pass_usf(usffilenamefullpath)
# -usffilenamefullpath : full path to usf file
# return 0 if ok, otherwise return 1
function check_conf_pass_usf()
{
    if [ $# -ne 1 ]
    then 
        if [ -e "$1" ] && [ -s "$1" ]
        then
            conftozerosix=$(grep -c -E 'confidence="0.600"' "$1")
            confall=$(grep -c -E 'confidence=' "$1")
            if [ $confall -gt 0 ]
            then
                pourcentageofzerosix=$((($conftozerosix*100)/$confall))
                if [ $pourcentageofzerosix -gt 49 ]
                then
                    return 1

                else
                    return 0
                fi
            fi
        else
            return 1
        fi
    fi
    return 0
}