Subject: Re: "which" command
From: [email-masked] (Frederic Corne)

9 Jan 1997 00:49:07 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Original-To: [email-masked]
In-Reply-To: <[email-masked]> (message from Ed Huott
	on Wed, 08 Jan 1997 17: 14:41 -0500)
Original-Sender: [email-masked]

> From: Ed Huott <[email-masked]>
> In message <[email-masked]>, Justin Gordon writes:
> >is there an implementation of "which"
> >
> >or is there a way to make find only search in the path?
> >
> There is a built-in command in the bash shell called `type' that will
> perform the equivalent of `which'. 

> There is also a native NT version of `which' called NTWHICH.EXE which is
> probably downloadable from any of the popular shareware sites.  It's
> freeware (GPL) authored by Jack J. Woehr.
> 

Yes this is not the right mailing-list, but ...

If you use nt-emacs, there is a little fonction from Peter Breton, which
avoid to use a sub-process :

;; By Peter Breton <[email-masked]>
(defun which (exe &optional showall)
  "Show the full path name of an executable.
This command searches the directories in `exec-path'"
  (interactive "sWhich: ")
  (catch 'answer
    (mapcar
     '(lambda (dir)
	(mapcar
	 '(lambda (suf)
	    (let ((try (expand-file-name (concat exe suf) dir)))
	      (and (file-executable-p try)
		   (null (file-directory-p try))
		   (progn
		     (message "%s is %s" exe try)
		     (throw 'answer try)))))
	 '("")))
     exec-path)
    (message "Can't find %s in search path" exe)
    nil))

-- 

****  Frederic CORNE   GSI-ERLI  [email-masked] ****
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".