I have a BASH script in org-mode file as org-babel source block. I hope to pass value contains environment variable to it through :var
.
something like these:
#+begin_src sh :var VAR1="~/foo"
mkdir ${VAR1}/test
and
#+begin_src sh :var VAR1="${MY_ENV_VAR}/foo"
mkdir ${VAR1}/test
When I run the code block with C-c C-c
, they all complain about can't find that ${VAR1}
directory.
I think inside the bash shell, ${VAR1}
is not expended proper.
What's the right way to do it?
#+begin_src sh :var VAR1=(substitute-in-file-name "$MY_ENV_VAR/foo")
. – Tobias Jun 22 '15 at 8:06${HOME}
, but still doesn't work with~
. – Enze Chi Jun 23 '15 at 12:09#+begin_src sh :var VAR1=(expand-file-name (substitute-in-file-name "$MY_ENV_VAR/foo"))
. This is ugly, I have to admit. – Tobias Jun 23 '15 at 12:16