Function: sh-var-value

sh-var-value is a byte-compiled function defined in sh-script.el.gz.

Signature

(sh-var-value VAR &optional IGNORE-ERROR)

Documentation

Return the value of variable VAR, interpreting symbols.

It can also return t or nil. If an invalid value is found, throw an error unless Optional argument IGNORE-ERROR is non-nil.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/sh-script.el.gz
(defun sh-var-value (var &optional ignore-error)
  "Return the value of variable VAR, interpreting symbols.
It can also return t or nil.
If an invalid value is found, throw an error unless Optional argument
IGNORE-ERROR is non-nil."
  (let ((val (symbol-value var)))
    (cond
     ((numberp val)
      val)
     ((eq val t)
      val)
     ((null val)
      val)
     ((eq val '+)
      sh-basic-offset)
     ((eq val '-)
      (- sh-basic-offset))
     ((eq val '++)
      (* 2 sh-basic-offset))
     ((eq val '--)
      (* 2 (- sh-basic-offset)))
     ((eq val '*)
      (/ sh-basic-offset 2))
     ((eq val '/)
      (/ (- sh-basic-offset) 2))
     (t
      (funcall (if ignore-error #'message #'error)
               "Don't know how to handle %s's value of %s" var val)
      0))))