1

I want to pass variables / arguments to a shell script in org-mode babel code-block by using the :var tag. Instead of reading the value of the variable, shell is just getting the literal x, which is empty (so ${x}="").

I would like the bash code block below in org-mode / org-babel to output "bar". How do I do that?

#+name: foo :var x=bar
#+begin_src bash 
echo x
#+end_src
3

I dont thing you can put in the #+name This should work:

#+name: foo 
#+begin_src bash :var x="bar"  
echo $x
#+end_src
  • :facepalm: of course! ><. it's always something stupid with me :D – Alejandro Erickson Jun 28 '16 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.