Function: eshell-get-variable

eshell-get-variable is a byte-compiled function defined in esh-var.el.gz.

Signature

(eshell-get-variable NAME &optional INDICES)

Documentation

Get the value for the variable NAME.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-var.el.gz
(defun eshell-get-variable (name &optional indices)
  "Get the value for the variable NAME."
  (let* ((alias (assoc name eshell-variable-aliases-list))
	 (var (if alias
		  (cadr alias)
		name)))
    (if (and alias (functionp var))
	(funcall var indices)
      (eshell-apply-indices
       (cond
	((stringp var)
	 (let ((sym (intern-soft var)))
	   (if (and sym (boundp sym)
		    (or eshell-prefer-lisp-variables
			(memq sym eshell--local-vars) ; bug#15372
			(not (getenv var))))
	       (symbol-value sym)
	     (getenv var))))
	((symbolp var)
	 (symbol-value var))
	(t
	 (error "Unknown variable `%s'" (eshell-stringify var))))
       indices))))