I have an org-mode file that contains a BASH script in an org-babel source block. I would like to pass environmental variable values to it through :var
.
something like:
#+begin_src sh :var VAR1="~/foo"
mkdir ${VAR1}/test
or:
#+begin_src sh :var VAR1="${MY_ENV_VAR}/foo"
mkdir ${VAR1}/test
When I run the blocks with C-c C-c
, they complain about not being able to find the ${VAR1}
directory.
I think ${VAR1}
is not being expanded properly inside the bash shell.
What's the right way to do it?
#+begin_src sh :var VAR1=(substitute-in-file-name "$MY_ENV_VAR/foo")
.${HOME}
, but still doesn't work with~
.#+begin_src sh :var VAR1=(expand-file-name (substitute-in-file-name "$MY_ENV_VAR/foo"))
. This is ugly, I have to admit.