Inserting document structure using tree command in PDF output

Not an answer about bash issue, but I wanted to share that for this I use fs::dir_tree from R directly

In case it may help.

3 Likes