From mboxrd@z Thu Jan 1 00:00:00 1970 From: sergio ruiz Subject: [org-babel] String interpolation using shell Date: Thu, 9 Jan 2020 11:56:19 -0500 Message-ID: <203196E9-AE09-4760-AF38-3D08D4622935@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Content-Type: multipart/signed; boundary="Apple-Mail=_2904AE4C-FB32-4A2A-84D5-479943409110"; protocol="application/pgp-signature"; micalg=pgp-sha256 Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:53270) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipb6f-0007fz-0c for emacs-orgmode@gnu.org; Thu, 09 Jan 2020 11:56:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipb6d-0001j9-KZ for emacs-orgmode@gnu.org; Thu, 09 Jan 2020 11:56:24 -0500 Received: from mail-io1-xd43.google.com ([2607:f8b0:4864:20::d43]:41173) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipb6d-0001d2-Ca for emacs-orgmode@gnu.org; Thu, 09 Jan 2020 11:56:23 -0500 Received: by mail-io1-xd43.google.com with SMTP id c16so7841639ioo.8 for ; Thu, 09 Jan 2020 08:56:22 -0800 (PST) Received: from [192.168.20.139] (rrcs-24-106-142-62.central.biz.rr.com. [24.106.142.62]) by smtp.googlemail.com with ESMTPSA id g3sm1533339ioq.75.2020.01.09.08.56.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jan 2020 08:56:20 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --Apple-Mail=_2904AE4C-FB32-4A2A-84D5-479943409110 Content-Type: multipart/alternative; boundary="Apple-Mail=_09E5F01A-B00C-4304-A701-5116A9311240" --Apple-Mail=_09E5F01A-B00C-4304-A701-5116A9311240 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hey, all. I am trying to set a string at the head of the file and use it in = different places in the file. Everything works correctly for somethign like ruby, but I am not sure = how do do this with a shell command. Just sets the string to the url #+NAME: url_name #+BEGIN_SRC ruby "http://www.google.com" #+END_SRC #+RESULTS: url_name : http://www.google.com #+BEGIN_SRC ruby :var url_input=3Durl_name url_input #+END_SRC #+RESULTS: : http://www.google.com ^^ This seems to work fine. #+BEGIN_SRC shell :var url_input=3Durl_name curl url_input #+END_SRC #+RESULTS: ^^ This doesn't work. It is trying to use "url_input" in the curl = command. #+BEGIN_SRC shell curl {url_input} #+END_SRC #+RESULTS: ^^ this doesn't work. It is trying to use "url_input" in the curl = command. Thanks! ---- peace, sergio photographer, journalist, visionary Public Key: = https://pgp.key-server.io/pks/lookup?op=3Dget&search=3D0x69B08F58923AB3A2 #BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV @sergio_101@mastodon.social https://sergio101.com http://www.codeandmusic.com http://www.twitter.com/sergio_101 http://www.facebook.com/sergio101 --Apple-Mail=_09E5F01A-B00C-4304-A701-5116A9311240 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
Hey, all.

I am trying to set a string at the head of the file and use = it in different places in the file.

Everything works correctly for = somethign like ruby, but I am not sure how do do this with a shell = command.

Just = sets the string to the url
#+NAME: = url_name
#+BEGIN_SRC ruby
#+END_SRC

#+RESULTS: url_name

#+BEGIN_SRC ruby :var = url_input=3Durl_name
url_input
#+END_SRC

#+RESULTS:

^^ This seems to work fine.

#+BEGIN_SRC shell :var = url_input=3Durl_name
  curl = url_input
#+END_SRC

#+RESULTS:

^^ This doesn't work. It is trying to = use "url_input" in the curl command.

#+BEGIN_SRC shell 
  curl {url_input}
#+END_SRC

#+RESULTS:

^^ this doesn't work. It is trying to use "url_input" in the = curl command.

Thanks!

----
peace,
sergio
photographer, journalist, visionary

Public Key: https://pgp.key-server.io/pks/lookup?op=3Dget&search=3D0x69= B08F58923AB3A2
#BitMessage = BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
https://sergio101.com
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101
=

= --Apple-Mail=_09E5F01A-B00C-4304-A701-5116A9311240-- --Apple-Mail=_2904AE4C-FB32-4A2A-84D5-479943409110 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE3eGd4191mOC5vqPaabCPWJI6s6IFAl4XWzMACgkQabCPWJI6 s6LtvhAA2BjYOEKH8pgM5qx2UvK9TBPx4xWGOJL1vyRG38UG4BohGbOy2dxndMxS afge58luNRxodm7BqQUBdqK0m5pic5pVjVgHkeAAJmHUEW1sD1bevpF4J6/2ECgZ 77k4jhGxGY4t4GLC4EyOWKh9ftENFtPeuE8Upfe71SGDSZCMbARPB9i7IHUhgZed rh5lHNE8eIpFx2XsGN6mOVknTHOw/daXYfh8FjEtBF1bJa5/vjX91GHZUT4Sh3Nf /mveN+vFyt84mGdTP3QH9bg7oz0M/+rKY05s/aRLrQd1NDUjq9mdBx7VCxrV3Aqe tLkEvhNbvw47m2L9y9YEqZcPk/QljmSqXDRFRHqsvCaIUsMJWJtyvfatNCCmJDP3 ER130fVdVR0ANcs6befwu8ivNyo715XjlEii3gtdXrEZsGrRD+e4MNbiX/lMMQ/t T6+ZFQF2ZKjir2P3Wouz6v0PY6wZx8g3eldt0mzqMrw7CuZf9lmpRHaTqj5vdIKN a/BxV8Too2R5s82NYPf4eP1XWr/nmTr6siMsFC4JLo3NsBCGyc//ed+FoZpcBatM PBx/l+WVvQAw6uAB9Eb/z5ex0sf8LWXg0SK0/DHiGSUbEK0pIyGvhh/iWCaWyOCR uknWncHs5pujgZ7qkq1CjDbTS05Y1uuwKq0tO4c9I/Pv/beodpY= =RBLR -----END PGP SIGNATURE----- --Apple-Mail=_2904AE4C-FB32-4A2A-84D5-479943409110--