emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: maurizio.vitale@polymath-solutions.com
Cc: emacs-orgmode@gnu.org
Subject: Re: [babel] passing strings in
Date: Thu, 25 Mar 2010 10:00:40 -0600	[thread overview]
Message-ID: <87ljdgjsr2.fsf@gmail.com> (raw)
In-Reply-To: 87eij8whoa.fsf@cuma.i-did-not-set--mail-host-address--so-tickle-me

Hi Maurizio,

The ip addresses in your table are being interpreted as source/reference
names which org-babel is trying to resolve.  In order to differentiate
between strings and reference names, we either must surround all strings
in double quotes (as below) or we must end all references with "()" and
disallow any strings which end in "()".  Currently we are taking the
former approach, which means your table will require the following to
work...

#+TBLNAME: system-host-ping :var host=system-hosts
| name   | ip               |           ping |
|--------+------------------+----------------|
| host 1 | "192.168.10.200" | 192.168.10.200 |
| host 2 | "192.168.10.24"  |  192.168.10.24 |
| host 3 | "192.168.42.24"  |  192.168.42.24 |
#+TBLFM: $3='(sbe system-ping (ip $2))'

#+source: system-ping
#+begin_src sh :var ip=0
# This is what I eventually want
#ping -w 10 -c 1 -q $ip >/dev/null 2>&1
#echo $?

# Testing
echo $ip
#+end_src

I'd be open to discussion on this issue.  I suppose if reference
resolution fails we could try using the name as a string literal, but
that could lead to debugging nightmares...

Cheers -- Eric

Maurizio Vitale
<mav@cuma.i-did-not-set--mail-host-address--so-tickle-me> writes:

> In the table/block pair below, I'm trying to pass an IP number to some
> shell code. It seems like in the table formula I can only have
> numbers. Is that right?
>
> #+TBLNAME: system-host-ping :var host=system-hosts
> | name      |             ip | ping   |
> |-----------+----------------+--------|
> | host 1    | 192.168.10.200 | #ERROR |
> | host 2    |  192.168.10.24 | #ERROR |
> | host 3    |  192.168.42.24 | #ERROR |
> #+TBLFM: $3='(sbe system-ping (ip $2))'
>
> #+source: system-ping
> #+begin_src sh 
> # This is what I eventually want
> #ping -w 10 -c 1 -q $ip >/dev/null 2>&1
> #echo $?
>
> # Testing
> echo $ip
> #+end_src
>
> Any way to pass arbitrary strings?
>
> Thanks a lot,
>
>        Maurizio
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  reply	other threads:[~2010-03-25 16:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-25 15:21 [babel] passing strings in Maurizio Vitale
2010-03-25 16:00 ` Eric Schulte [this message]
2010-03-25 16:17   ` Maurizio Vitale
2010-03-25 17:12     ` Eric Schulte
2010-03-25 16:49   ` Dan Davison
2010-03-25 19:05     ` Thomas S. Dye
2010-03-25 19:23     ` Dan Davison
2010-03-25 19:48       ` Eric Schulte
2010-03-25 16:09 ` Dan Davison
2010-03-25 16:21   ` Maurizio Vitale

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=87ljdgjsr2.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=maurizio.vitale@polymath-solutions.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).