Last active
July 13, 2017 01:01
-
-
Save Pk13055/60535d85f8e73ed4881b21ee5110229d to your computer and use it in GitHub Desktop.
Bash Script to make a git tree with links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
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
How to run
chmod 755 git-tree.sh
: Change permissions to make it executable./git-tree.sh <dir>
: Display the tree for the givendir
./git-tree.sh <dir> >> filename.md
To append the tree to a givenfilename