I am working on a .Rmd
document where we show people how to use the command line. This includes bash-based code blocks like this:
```{bash}
echo "this is a test"
```
However, we would like to parameterize this, so have something like
---
params:
testparam: "this would echo something else"
---
```{bash}
echo params$testparam
```
This doesn't work, however, because inside a bash
code block the parameters don't exist.
Is there a way to use parameters in such cases, in essence evaluating params$testparam
before knitr considers the fact that it's inside a non-R code block?
Ideally, the solution would make the following possible:
```{bash}
echo params$testparam
```
turns into
<pre class="bash"><code>echo "this would echo something else"</code></pre>
<pre><code>## this would echo something else</code></pre>