Function: eshell-search-path

eshell-search-path is a byte-compiled function defined in esh-ext.el.gz.

Signature

(eshell-search-path NAME)

Documentation

Search the environment path for NAME.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-ext.el.gz
(defun eshell-search-path (name)
  "Search the environment path for NAME."
  (if (file-name-absolute-p name)
      name
    (let ((list (eshell-get-path))
	  suffixes n1 n2 file)
      (while list
	(setq n1 (concat (car list) name))
	(setq suffixes eshell-binary-suffixes)
	(while suffixes
	  (setq n2 (concat n1 (car suffixes)))
	  (if (and (or (file-executable-p n2)
		       (and eshell-force-execution
			    (file-readable-p n2)))
		   (not (file-directory-p n2)))
	      (setq file n2 suffixes nil list nil))
	  (setq suffixes (cdr suffixes)))
	(setq list (cdr list)))
      file)))