4

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)?

  • 3
    I thought of the same thing seven years ago: https://stackoverflow.com/q/17820740/559676 but I don't remember now why I didn't improve the `bash` engine in **knitr**. If anyone can figure out how to do it, I'd appreciate a pull request on Github: https://github.com/yihui/knitr – Yihui Xie May 08 '20 at 02:21

0 Answers0