How to change the output of a knitr chunk with bash engine

Viewed 80

When running knitr::knit() in a Rmd file with this:

```{r setup, include=FALSE}
knitr::opts_chunk$set(collapse = TRUE)
```

```{bash}
which R
which bash
```

The output (a md file) is

```bash
which R
which bash
## /usr/local/bin/R
## /usr/bin/bash
```

Is there a way to make the output look like this:

```bash
which R
## /usr/local/bin/R
which bash
## /usr/bin/bash
```

i.e., each output below each command (like a normal r chunk would do with R commands)?

0 Answers
Related