3f7ec313053fa504911f69798236f571b8932e3f
hiram
  Sun May 17 13:55:40 2020 -0700
fixup use of type command for debian dash shell refs #25528

diff --git src/hg/utils/automation/blastz-run-ucsc src/hg/utils/automation/blastz-run-ucsc
index 0e6528d..74fc78d 100755
--- src/hg/utils/automation/blastz-run-ucsc
+++ src/hg/utils/automation/blastz-run-ucsc
@@ -116,31 +116,31 @@
   # Run a command in sh, with PATH specified in %defVars.
   my ($cmd) = @_;
   my $setPath = "export PATH=";
   $setPath .= "$defVars{PATH}:" if (defined $defVars{'PATH'});
   $setPath .= "$defaultPath; ";
   my $failPath = "set -xbeEu -o pipefail; ";
   system("$shCmd", "-c", $setPath . $failPath . $cmd) == 0 ||
     &cleanDie("Command failed:\n$setPath\n$cmd\n");
 }
 
 sub findCommand {
   my ($cmd) = @_;
   my $setPath = "PATH=";
   $setPath .= "$defVars{PATH}:" if (defined $defVars{'PATH'});
   $setPath .= "$defaultPath; ";
-  my $which = qx{$setPath type -ap $cmd 2> /dev/null | head -1};
+  my $which = qx{$setPath type -ap $cmd 2> /dev/null | grep -v "not found" | head -1 | awk '{print \$NF}' };
   chomp $which;
   $which = $cmd if ($which eq "");
   return $which;
 }
 
 sub nfsNoodge {
   # Try to access the given file/dir; if it fails, don't die, just
   # wait a second, try again.
   # Scott's blastz-run included a similar trick.
   my ($file) = @_;
   my $ret = system("$shCmd", "-c", "$lsCmd -d $file > /dev/null");
   if ($ret != 0) {
     sleep 1;
     $ret = system("$shCmd", "-c", "$lsCmd -d $file > /dev/null");
     sleep 1 if ($ret != 0);