d0dfc899d227e86e3c5391019f1f2a1de296ca04 mspeir Thu Aug 25 14:53:24 2016 -0700 Simplifying code that invokes verbose mode based on feedback from Chris in CR, refs #17728 diff --git src/utils/qa/bigPush.sh src/utils/qa/bigPush.sh index ef6a396..82ce6f9 100755 --- src/utils/qa/bigPush.sh +++ src/utils/qa/bigPush.sh @@ -7,32 +7,31 @@ # # 04-15-16 # Matt Speir # # Designed to make large pushes # of many tables for many assemblies # easier. # ################################ ##### Variables ##### dbList="" tableList="" -verboseMode="" -outputMode="" +outputMode="> /dev/null" ##### Functions ##### showHelp() { cat << EOF Usage: `basename $0` [-hv] \$database(s) \$table(s) Required arguments: \$database(s) A single database or list of databases for which table(s) will be pushed. This list can be a file. \$table(s) A single table or list of tables to be pushed. List of tables can be a file. Optional arguments: @@ -55,66 +54,55 @@ EOF } ##### Parse command-line input ##### OPTIND=1 # Reset is necessary if getopts was used previously in the script. It is a good idea to make this local in a function. while getopts "hv" opt do case $opt in h) showHelp exit 0 ;; v) - verboseMode=true + outputMode="" ;; '?') showHelp >&2 exit 1 ;; esac done shift "$((OPTIND-1))" # Shift off the options and optional --. # Check number of required arguments if [ $# -ne 2 ] then # Output usage message if number of required arguments is wrong showHelp >&2 exit 1 else # Set variables with required argument values dbList=$1 tableList=$2 fi ##### Main Program ##### -# Adjust output mode based on specified verbose mode -if [[ "$verboseMode" == "true" ]] -then - # Will cause output to be sent to stdout - outputMode="" -else - # if no verbose mode specified just send output to /dev/null - outputMode="> /dev/null" -fi - - # First check if dbList is a file. # If not, skips down to "# Here" if [[ -e "$dbList" ]] then # Loop through our dbList file for db in $(cat "$dbList") do # Now check if tableList is a file if [[ -e "$tableList" ]] then # If tableList was a file, loop through contents for tbl in $(cat "$tableList") do # Build command with proper database, table name, and output mode. command="sudo mypush '$db' '$tbl' mysqlbeta $outputMode"