forked from mirrors/org-mode
babel: shell command used by org-babel-sh is now configurable using the org-babel-sh-command variable
This commit is contained in:
parent
e4bc599745
commit
047ac8ab1b
|
@ -36,6 +36,10 @@
|
||||||
|
|
||||||
(add-to-list 'org-babel-tangle-langs '("sh" "sh" "#!/usr/bin/env sh"))
|
(add-to-list 'org-babel-tangle-langs '("sh" "sh" "#!/usr/bin/env sh"))
|
||||||
|
|
||||||
|
(defvar org-babel-sh-command "sh"
|
||||||
|
"Command used to invoke a shell. This will be passed to
|
||||||
|
`shell-command-on-region'")
|
||||||
|
|
||||||
(defun org-babel-execute:sh (body params)
|
(defun org-babel-execute:sh (body params)
|
||||||
"Execute a block of Shell commands with org-babel. This
|
"Execute a block of Shell commands with org-babel. This
|
||||||
function is called by `org-babel-execute-src-block'."
|
function is called by `org-babel-execute-src-block'."
|
||||||
|
@ -122,7 +126,7 @@ last statement in BODY."
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert body)
|
(insert body)
|
||||||
;; (message "buffer=%s" (buffer-string)) ;; debugging
|
;; (message "buffer=%s" (buffer-string)) ;; debugging
|
||||||
(shell-command-on-region (point-min) (point-max) "sh" 'replace)
|
(shell-command-on-region (point-min) (point-max) org-babel-sh-command 'replace)
|
||||||
(case result-type
|
(case result-type
|
||||||
(output (buffer-string))
|
(output (buffer-string))
|
||||||
(value ;; TODO: figure out how to return non-output values from shell scripts
|
(value ;; TODO: figure out how to return non-output values from shell scripts
|
||||||
|
|
Loading…
Reference in New Issue