Mail Archives: cygwin/1997/01/09/00:49:07
> From: Ed Huott <huott AT pinebush DOT com>
> In message <32D3EA6F DOT 901 AT infoscape DOT com>, 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 <pbreton AT i-kinetics DOT com>
(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 frederic DOT corne AT erli DOT fr ****
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -