diff --git a/bin/pt-pmp b/bin/pt-pmp index bab0dc24..d4164f06 100755 --- a/bin/pt-pmp +++ b/bin/pt-pmp @@ -4,6 +4,8 @@ # See "COPYRIGHT, LICENSE, AND WARRANTY" at the end of this file for legal # notices and disclaimers. +TOOL="pt-pmp" + # ########################################################################### # tmpdir package # This package is a copy without comments from the original. The original @@ -212,7 +214,8 @@ main() { # Execute the program if it was not included from another file. This makes it # possible to include without executing, and thus test. -if [ "$(basename "$0")" = "pt-pmp" ] || [ "$(basename "$0")" = "bash" -a "$_" = "$0" ]; then +if [ "${0##*/}" = "$TOOL" ] \ + || [ "${0##*/}" = "bash" -a "$_" = "$0" ]; then mk_tmpdir main "$@" rm_tmpdir diff --git a/bin/pt-sift b/bin/pt-sift index cc29b3d9..c0615821 100755 --- a/bin/pt-sift +++ b/bin/pt-sift @@ -1,5 +1,7 @@ #!/usr/bin/env bash +TOOL="pt-sift" + # This program is part of Percona Toolkit: http://www.percona.com/software/ # See "COPYRIGHT, LICENSE, AND WARRANTY" at the end of this file for legal # notices and disclaimers. @@ -536,7 +538,8 @@ main() { # Execute the program if it was not included from another file. This makes it # possible to include without executing, and thus test. -if [ "$(basename "$0")" = "pt-sift" ] || [ "$(basename "$0")" = "bash" -a "$_" = "$0" ]; then +if [ "${0##*/}" = "$TOOL" ] \ + || [ "${0##*/}" = "bash" -a "$_" = "$0" ]; then main "$@" fi