Patch from PR#4872 implementing a "-a" option added, plus documentation.
This commit is contained in:
parent
64b1551844
commit
7ca3defa5f
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: which.1,v 1.4 1997/10/20 03:19:23 lukem Exp $
|
||||
.\" $NetBSD: which.1,v 1.5 1999/03/11 11:15:44 fair Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1991 Regents of the University of California.
|
||||
.\" All rights reserved.
|
||||
@ -32,7 +32,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" from: @(#)which.1 6.3 (Berkeley) 4/23/91
|
||||
.\" $NetBSD: which.1,v 1.4 1997/10/20 03:19:23 lukem Exp $
|
||||
.\" $NetBSD: which.1,v 1.5 1999/03/11 11:15:44 fair Exp $
|
||||
.\"
|
||||
.Dd April 23, 1991
|
||||
.Dt WHICH 1
|
||||
@ -44,17 +44,27 @@
|
||||
only)
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Ar name
|
||||
.Ar ...
|
||||
.Op Fl a
|
||||
.Ar name
|
||||
.Op Ar ...
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
takes a list of names and looks for the files which would be
|
||||
executed had these names been given as commands.
|
||||
Each argument is expanded if it is aliased,
|
||||
and searched for along the user's path.
|
||||
and searched for along the user's
|
||||
.Ev PATH .
|
||||
Both aliases and path are taken from the user's
|
||||
.Pa \&.cshrc
|
||||
file.
|
||||
.Pp
|
||||
If the
|
||||
.Fl a
|
||||
flag is given,
|
||||
.Nm
|
||||
will continue to search the
|
||||
.Ev PATH
|
||||
until all instances of a program file are found.
|
||||
.Sh FILES
|
||||
.Bl -tag -width ~/\&.cshrc
|
||||
.It Pa ~/\&.cshrc
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/csh
|
||||
# $NetBSD: which.csh,v 1.2 1999/02/15 04:54:37 hubertf Exp $
|
||||
# $NetBSD: which.csh,v 1.3 1999/03/11 11:15:44 fair Exp $
|
||||
#
|
||||
# DO NOT USE "csh -f"
|
||||
#
|
||||
@ -41,6 +41,11 @@
|
||||
#
|
||||
set prompt = "% "
|
||||
set noglob
|
||||
unset keepgoing
|
||||
if ( $1 == "-a" ) then
|
||||
set keepgoing=1
|
||||
shift
|
||||
endif
|
||||
foreach arg ( $argv )
|
||||
set alius = `alias $arg`
|
||||
switch ( $#alius )
|
||||
@ -66,7 +71,7 @@ foreach arg ( $argv )
|
||||
if ( -x $i/$arg && ! -d $i/$arg ) then
|
||||
echo $i/$arg
|
||||
set found
|
||||
break
|
||||
if ( ! $?keepgoing ) break
|
||||
endif
|
||||
end
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user