diff --git a/bin/pt-ioprofile b/bin/pt-ioprofile index b4c78de9..785e7dfb 100755 --- a/bin/pt-ioprofile +++ b/bin/pt-ioprofile @@ -65,6 +65,7 @@ _d () { + set -u ARGV="" # Non-option args (probably input files) @@ -96,6 +97,11 @@ usage_or_errors() { return 1 fi + if [ -z $(_which perl) ]; then + echo "Perl binary required to run this tool" + return 1 + fi + if [ "$OPT_HELP" ]; then usage "$file" echo diff --git a/bin/pt-mext b/bin/pt-mext index ad1c7ee7..df068aab 100755 --- a/bin/pt-mext +++ b/bin/pt-mext @@ -106,6 +106,7 @@ rm_tmpdir() { + set -u ARGV="" # Non-option args (probably input files) @@ -137,6 +138,11 @@ usage_or_errors() { return 1 fi + if [ -z $(_which perl) ]; then + echo "Perl binary required to run this tool" + return 1 + fi + if [ "$OPT_HELP" ]; then usage "$file" echo diff --git a/bin/pt-mysql-summary b/bin/pt-mysql-summary index f6d7480e..681b153f 100755 --- a/bin/pt-mysql-summary +++ b/bin/pt-mysql-summary @@ -67,6 +67,7 @@ _d () { + set -u ARGV="" # Non-option args (probably input files) @@ -98,6 +99,11 @@ usage_or_errors() { return 1 fi + if [ -z $(_which perl) ]; then + echo "Perl binary required to run this tool" + return 1 + fi + if [ "$OPT_HELP" ]; then usage "$file" echo diff --git a/bin/pt-pmp b/bin/pt-pmp index 0639961d..0aacb473 100755 --- a/bin/pt-pmp +++ b/bin/pt-pmp @@ -108,6 +108,7 @@ rm_tmpdir() { + set -u ARGV="" # Non-option args (probably input files) @@ -139,6 +140,11 @@ usage_or_errors() { return 1 fi + if [ -z $(_which perl) ]; then + echo "Perl binary required to run this tool" + return 1 + fi + if [ "$OPT_HELP" ]; then usage "$file" echo diff --git a/bin/pt-sift b/bin/pt-sift index c31b36d5..bbf077cf 100755 --- a/bin/pt-sift +++ b/bin/pt-sift @@ -106,6 +106,7 @@ rm_tmpdir() { + set -u ARGV="" # Non-option args (probably input files) @@ -137,6 +138,11 @@ usage_or_errors() { return 1 fi + if [ -z $(_which perl) ]; then + echo "Perl binary required to run this tool" + return 1 + fi + if [ "$OPT_HELP" ]; then usage "$file" echo diff --git a/bin/pt-stalk b/bin/pt-stalk index c2085e02..9f8d86a6 100755 --- a/bin/pt-stalk +++ b/bin/pt-stalk @@ -119,6 +119,7 @@ kill_all_subshells() { + set -u ARGV="" # Non-option args (probably input files) @@ -150,6 +151,11 @@ usage_or_errors() { return 1 fi + if [ -z $(_which perl) ]; then + echo "Perl binary required to run this tool" + return 1 + fi + if [ "$OPT_HELP" ]; then usage "$file" echo diff --git a/bin/pt-summary b/bin/pt-summary index bcbdb07b..cf000117 100755 --- a/bin/pt-summary +++ b/bin/pt-summary @@ -74,6 +74,7 @@ _d () { + set -u ARGV="" # Non-option args (probably input files) @@ -105,6 +106,11 @@ usage_or_errors() { return 1 fi + if [ -z $(_which perl) ]; then + echo "Perl binary required to run this tool" + return 1 + fi + if [ "$OPT_HELP" ]; then usage "$file" echo diff --git a/lib/bash/parse_options.sh b/lib/bash/parse_options.sh index 23501d2f..97fe0c4e 100644 --- a/lib/bash/parse_options.sh +++ b/lib/bash/parse_options.sh @@ -26,6 +26,10 @@ # GLOBAL $PT_TMPDIR AND $TOOL MUST BE SET BEFORE USING THIS LIB! # XXX +# XXX +# THIS LIB REQUIRES alt_cmds! +# XXX + # Parsing command line options with Bash is easy until we have to dealt # with values that have spaces, e.g. --option="hello world". This is # further complicated by command line vs. config file. From the command @@ -87,6 +91,11 @@ usage_or_errors() { return 1 fi + if [ -z $(_which perl) ]; then + echo "Perl binary required to run this tool" + return 1 + fi + if [ "$OPT_HELP" ]; then usage "$file" echo diff --git a/t/lib/bash/parse_options.sh b/t/lib/bash/parse_options.sh index 4beba5a0..eefda815 100644 --- a/t/lib/bash/parse_options.sh +++ b/t/lib/bash/parse_options.sh @@ -7,6 +7,7 @@ TOOL="pt-stalk" PT_TMPDIR="$TEST_PT_TMPDIR" source "$LIB_DIR/log_warn_die.sh" +source "$LIB_DIR/alt_cmds.sh" source "$LIB_DIR/parse_options.sh" # ############################################################################