diff options
author | helbig <helbig@FreeBSD.org> | 1998-02-01 20:01:29 +0000 |
---|---|---|
committer | helbig <helbig@FreeBSD.org> | 1998-02-01 20:01:29 +0000 |
commit | 53c968c45494a82f8f677f9fd1488113045dd957 (patch) | |
tree | bdc0de5fce565af77493da1c19cddae65675dba3 /usr.bin/which | |
parent | 188cf22a57ecce425f4207b8addfb5d09d3bfd9c (diff) | |
download | FreeBSD-src-53c968c45494a82f8f677f9fd1488113045dd957.zip FreeBSD-src-53c968c45494a82f8f677f9fd1488113045dd957.tar.gz |
Search for proper executables, ignore directories
Diffstat (limited to 'usr.bin/which')
-rwxr-xr-x | usr.bin/which/which.pl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/which/which.pl b/usr.bin/which/which.pl index 688eb6a..55214a6 100755 --- a/usr.bin/which/which.pl +++ b/usr.bin/which/which.pl @@ -24,7 +24,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $Id: which.pl,v 1.11 1997/08/26 11:13:39 charnier Exp $ +# $Id: which.pl,v 1.12 1998/01/02 13:46:25 helbig Exp $ $all = $silent = $found = 0; @path = split(/:/, $ENV{'PATH'}); @@ -42,13 +42,13 @@ if ($ARGV[0] eq "-a") { } foreach $prog (@ARGV) { - if ("$prog" =~ '/' && -x "$prog") { + if ("$prog" =~ '/' && -x "$prog" && -f "$prog") { print "$prog\n" unless $silent; $found = 1; } else { foreach $e (@path) { $e = "." if !$e; - if (-x "$e/$prog") { + if (-x "$e/$prog" && -f "$e/$prog") { print "$e/$prog\n" unless $silent; $found = 1; last unless $all; |