return to PRS Technologies website


validate_period.sh
############################################################################### # # Module: validate_period.sh # Author: Peter R. Schmidt # Description: Validate the Elite accounting period # for use in shell scripts # # ARG 1 = period to validate # # RETURN 0 if valid # RETURN 1 if invalid # # Change Log # # Date Name Description................. # 03/03/01 Peter R. Schmidt Start Program # ############################################################################### if [ $# -ne 1 ]; then echo "usage: validate_period.sh [ PERIOD ]" exit 1 fi . /elite/custom/run.elite PERIOD=$1 CNT=`dbaccess son_db -<<EOF 2>/dev/null | egrep -v "count|retrieved|Database closed|^$" select count(*) from periodt where pe = "$PERIOD" and petime = "OP"; EOF ` if [ $CNT = 1 ]; then exit 0 else exit 1 fi ################################################################################