70124b0bcc90d53de666f37cccd6b1a4356161de hiram Thu Feb 2 12:45:54 2023 -0800 correctly check for an unbound variable no redmine diff --git src/hg/utils/otto/genArk/updateHgcentral.sh src/hg/utils/otto/genArk/updateHgcentral.sh index 6f0836a..95545e1 100755 --- src/hg/utils/otto/genArk/updateHgcentral.sh +++ src/hg/utils/otto/genArk/updateHgcentral.sh @@ -1,30 +1,40 @@ #!/bin/bash # *** Do not edit this file outside of the source tree. *** # This file is from source tree: # kent/src/hg/utils/otto/genArk/updatgeHgcentral.sh # called by otto cron job in /hive/data/inside/GenArk/ # and using the helper script: # kent/src/hg/utils/otto/genArk/genArkListToSql.pl # exit on any error set -beEu -o pipefail -if [ "xxx$1" != "xxxmakeItSo" ]; then +function usage() { printf "usage: ./updateCentral.sh makeItSo\n" 1>&2 printf "updates hgcentral.genark with the latest hub list from hgdownload\n" 1>&2 +} + +# check for an 'unbound' variable safely +if [ -z "${1+x}" ]; then + usage + exit 255 +fi +# something is in $1, verify is is 'makeItSo' +if [ "xxx$1" != "xxxmakeItSo" ]; then + usage exit 255 fi cd /hive/data/inside/GenArk export DS=`date "+%F"` export YYYY=`date "+%Y"` export LC_NUMERIC=en_US export msgTo="hclawson@ucsc.edu" # export msgTo="hclawson@ucsc.edu,lrnassar@ucsc.edu" export msgFile="/tmp/ottoGenArk.$$.txt" ########################################################################### ### helper functions ###########################################################################