Re: [PATCH 1/3] configure: Add test for Perl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 06, 2006 at 03:58:47PM +0200, Matthias Lederhofer wrote:
> This will not work with spaces in $PATH. I'd do something like this if
> cut is portable (I have only freebsd and linux to test):

This should work with shell/builtins only, no sed/cut:

 path=${PATH}:
 while test -n "$path"; do
   p=${path%%:*}/$1
   test ! -x "$p" || { echo "$p"; return 0; }
   path=${path#*:}
 done
 test ! -x "$1" || { echo "$1" && return 0; }
 return 1

Regards, Gerrit.
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]