function GetPasswd { RunCounter=1 DB_PSSWD=getpassword while [ -z "${DB_PSSWD}" -a ${RunCounter} -le 20 ] ; do DB_PSSWD=getpassword sleep 3 ## To address error "Cannot open /proc/net/tcp" and retry after 3 seconds let RunCounter=${RunCounter}+1 done if [ ! -z "${DB_PSSWD}" ] then export DB_PSSWD=${DB_PSSWD} else echo "Get DB password error" exit 1 fi }