emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: George Jones <eludom@gmail.com>
To: emacs-orgmode@gnu.org
Subject: errors setting sh arrays
Date: Wed, 26 Dec 2012 09:34:34 -0500	[thread overview]
Message-ID: <CAOhM7yWj6tM3OkzYMU=uLo9tR95E07ZRdmkrUyE-dXh3KY9iAA@mail.gmail.com> (raw)


[-- 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




             reply	other threads:[~2012-12-26 14:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-26 14:34 George Jones [this message]
2012-12-26 16:03 ` errors setting sh arrays Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOhM7yWj6tM3OkzYMU=uLo9tR95E07ZRdmkrUyE-dXh3KY9iAA@mail.gmail.com' \
    --to=eludom@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=gmj@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).