# String interpolation in the short-hand call of macro @bash1\_str

**URL:** <https://discourse.julialang.org/t/string-interpolation-in-the-short-hand-call-of-macro-bash1-str/51846>\
**Category:** General Usage\
**Tags:** macros, string-interpolation\
**Created:** [December 15, 2020, 1:40am UTC](https://discourse.julialang.org/t/string-interpolation-in-the-short-hand-call-of-macro-bash1-str/51846 "2020-12-15T01:40:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lian\_Yunlong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lian_yunlong/32/14437_2.png) [@Lian\_Yunlong](https://discourse.julialang.org/u/Lian_Yunlong)\
**Post date:** [December 15, 2020, 1:40am UTC](https://discourse.julialang.org/t/string-interpolation-in-the-short-hand-call-of-macro-bash1-str/51846/1 "2020-12-15T01:40:30Z")

</div>

Hello everyone,  
I am trying to improve the following macro:  
`macro bash1_str(s1) s = eval(s1); println(s); open(`bash`,"w",stdout) do io; print(io, s); end; end ;`  
If I call  
`@bash1_str "mkdir $FD"`  
The string `FD` is interpolated. But if I use the shorthand call  
`bash1"mkdir $FD"`  
The interpolation DOES NOT happen. How can I enforce the interpolation in the shorthand call?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 15, 2020, 12:09pm UTC](https://discourse.julialang.org/t/string-interpolation-in-the-short-hand-call-of-macro-bash1-str/51846/2 "2020-12-15T12:09:36Z")

</div>

Note that your macro appears to have side effects and not an AST transformation, and as such it may not do what you want in general.

That said, non-standard string literals specifically do not perform string interpolation automatically — that’s kind of the point. You could do it manually, but I am not sure why the whole thing isn’t just a function — you could just construct a [command](https://docs.julialang.org/en/v1/manual/running-external-programs/#command-interpolation) to run `bash`.

---

<div class="post-metadata">

**Author:** ![Lian\_Yunlong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lian_yunlong/32/14437_2.png) [@Lian\_Yunlong](https://discourse.julialang.org/u/Lian_Yunlong)\
**Post date:** [December 31, 2020, 3:01am UTC](https://discourse.julialang.org/t/string-interpolation-in-the-short-hand-call-of-macro-bash1-str/51846/3 "2020-12-31T03:01:54Z")

</div>

thanks Tamas, I think this macro is not necessary.
