summaryrefslogtreecommitdiffstats
path: root/usr.bin/which
diff options
context:
space:
mode:
authorhelbig <helbig@FreeBSD.org>1998-02-01 20:01:29 +0000
committerhelbig <helbig@FreeBSD.org>1998-02-01 20:01:29 +0000
commit53c968c45494a82f8f677f9fd1488113045dd957 (patch)
treebdc0de5fce565af77493da1c19cddae65675dba3 /usr.bin/which
parent188cf22a57ecce425f4207b8addfb5d09d3bfd9c (diff)
downloadFreeBSD-src-53c968c45494a82f8f677f9fd1488113045dd957.zip
FreeBSD-src-53c968c45494a82f8f677f9fd1488113045dd957.tar.gz
Search for proper executables, ignore directories
Diffstat (limited to 'usr.bin/which')
-rwxr-xr-xusr.bin/which/which.pl6
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;
OpenPOWER on IntegriCloud