problem-solving read.. think.. solve and code. tree=$(tree -tf --noreport -I '~' --charset ascii $1 | sed -e 's/| +/ /g' -e 's/[|`]-+/ /g' -e 's:( )((./)([^/]+)):\1\4:g') printf "# Project tree\n\n${tree}"