emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* errors setting sh arrays
@ 2012-12-26 14:34 George Jones
  2012-12-26 16:03 ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: George Jones @ 2012-12-26 14:34 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 149 bytes --]

Next up, it seems that I have to use a :session to set arrays in sh code on
a remote system or you get a shell syntax error.  See attached .org file

[-- Attachment #1.2: Type: text/html, Size: 201 bytes --]

[-- Attachment #2: arrayRemote.org --]
[-- Type: application/octet-stream, Size: 2024 bytes --]

#+TITLE: Org-bable test of sh arrays
#+AUTHOR: George Jones
#+DATE: December 26, 2012

* Setting arrrays
    - "foo=(bar baz)" works sometimes and causes errors others
    - ssh://localhost#2222 is an Ubuntu 12.04 system
    - No .emacs or .bashrc on either side, just
#+BEGIN_SRC elisp
(org-babel-do-load-languages
    'org-babel-load-languages '((python . t) (sh . t) (lisp . t) (R . t) (ditaa . t)))
(setq org-confirm-babel-evaluate nil)
(message "done setting languages")
#+END_SRC

#+RESULTS:
: done setting languages

** Code
#+name: execOnLocalVM
#+BEGIN_SRC sh :dir /george@localhost#2222: :results output :exports both :session X
set -x
hostname                                                                                                                                               
echo executed on `hostname` at `date` in `pwd`                                                                                                                  
echo $SHELL
foo=(bar baz)
echo ${foo[*]}
#+END_SRC                                                                                                                                              

#+RESULTS:
: Georges-MacBook-Pro.local
: executed on Georges-MacBook-Pro.local at Wed Dec 26 09:32:04 EST 2012 in /Users/gmj/Org/test
: /bin/bash
: bar baz

** Results with a session
   - This is the results with a :session tag
   - It worked as expected
#+RESULTS: execOnLocalVM
#+begin_example
+ set -x
+ hostname
garlic
++ hostname
++ date
++ pwd
+ echo executed on garlic at Wed Dec 26 14:32:19 UTC 2012 in /home/george
executed on garlic at Wed Dec 26 14:32:19 UTC 2012 in /home/george
+ echo /bin/bash
/bin/bash
+ foo=(bar baz)
+ echo bar baz
bar baz
#+end_example

** Results without a session
   - Without a :session tag, the *Org-Bable Error Output* buffer contains:
#+begin_example
+ hostname
+ hostname
+ date
+ pwd
+ echo executed on garlic at Wed Dec 26 14:18:52 UTC 2012 in /home/george
+ echo /bin/bash
sh: 5: Syntax error: "(" unexpected
#+end_example




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-26 16:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-26 14:34 errors setting sh arrays George Jones
2012-12-26 16:03 ` Eric Schulte

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).