5

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

1 Answer 1

8

I don't think you can put in the #+name.

This should work:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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