From: William Denton <email@example.com>
Subject: How to get a table into a variable in a shell code block?
Date: Sat, 3 Apr 2021 14:14:56 -0400 (EDT) [thread overview]
Message-ID: <alpine.DEB.firstname.lastname@example.org> (raw)
Let's say I have a table like this:
| one |
| two |
| three |
I want to run through those numbers in a shell code block, but it I pass in
table as a variable, it only sees the first number.
#+begin_src shell :results output :var n=numbers
In Ruby it sees the numbers as an array:
#+begin_src ruby :results output :var n=numbers
And in R sees them as a data.table with one column. Both are very easy to
iterate over, of course.
I looked at the docs, but didn't see this covered, then I looked at ob-shell.el
and saw the "org-babel--variable-assignments:bash_array" function, which might
or might not be relevant, but it's all beyond my comprehension.
Is there a way to get my shell code seeing all of the elements in the column?
William Denton :: Toronto, Canada --- Listening to Art: https://listeningtoart.org/
https://www.miskatonic.org/ --- GHG.EARTH: https://ghg.earth/
Caveat lector. --- STAPLR: https://staplr.org/
next reply other threads:[~2021-04-03 18:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-03 18:14 William Denton [this message]
2021-04-03 18:45 ` How to get a table into a variable in a shell code block? Greg Minshall
2021-04-03 18:57 ` William Denton
2021-04-04 5:26 ` Michael Welle
2021-04-03 19:01 ` Juan Manuel Macías
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:
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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
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).