1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-27 07:37:25 +00:00

ob-sh: robustification

* lisp/ob-sh.el (org-babel-sh-var-to-sh): Wrap end token of heredoc in
  single quotes which is the best practice.
  (org-babel-sh-table-or-results): Use `org-babel-script-escape' for
  more robust parsing of shell output.
This commit is contained in:
Eric Schulte 2010-11-23 09:38:15 -07:00
parent b174975eb7
commit 90bd46a6d5

View File

@ -100,7 +100,7 @@ var of the same value."
(if (listp el)
(mapcar #'deep-string el)
(org-babel-sh-var-to-sh el sep))))
(format "$(cat <<BABEL_TABLE\n%s\nBABEL_TABLE\n)"
(format "$(cat <<'BABEL_TABLE'\n%s\nBABEL_TABLE\n)"
(orgtbl-to-generic
(deep-string (if (listp (car var)) var (list var)))
(list :sep (or sep "\t")))))
@ -114,16 +114,7 @@ var of the same value."
"Convert RESULTS to an appropriate elisp value.
If the results look like a table, then convert them into an
Emacs-lisp table, otherwise return the results as a string."
(org-babel-read
(if (string-match "^\\[.+\\]$" results)
(org-babel-read
(concat "'"
(replace-regexp-in-string
"\\[" "(" (replace-regexp-in-string
"\\]" ")" (replace-regexp-in-string
", " " " (replace-regexp-in-string
"'" "\"" results))))))
results)))
(org-babel-script-escape results))
(defun org-babel-sh-initiate-session (&optional session params)
"Initiate a session named SESSION according to PARAMS."