Skip to content

Instantly share code, notes, and snippets.

@L04DB4L4NC3R
Created July 7, 2020 18:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save L04DB4L4NC3R/027c97d71a2a804d99d4e5b2023e6d08 to your computer and use it in GitHub Desktop.
Save L04DB4L4NC3R/027c97d71a2a804d99d4e5b2023e6d08 to your computer and use it in GitHub Desktop.
Tree command output to markdown
#!/bin/bash
#File: tree-md
tree=$(tree -tf --noreport -I '*~' --charset ascii $1 |
sed -e 's/| \+/ /g' -e 's/[|`]-\+/ */g' -e 's:\(* \)\(\(.*/\)\([^/]\+\)\):\1[\4](\2):g')
printf "# Project tree\n\n${tree}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment