emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] [babel] passing strings in


From: Eric Schulte
Subject: Re: [Orgmode] [babel] passing strings in
Date: Thu, 25 Mar 2010 10:00:40 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux)

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
<address@hidden> 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.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode




reply via email to

[Prev in Thread] Current Thread [Next in Thread]