Last active
August 29, 2015 14:02
-
-
Save bichotll/936bc8e9114d01f1af92 to your computer and use it in GitHub Desktop.
Add directory at Home.md (for Wikis)
This file contains 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
#create rutes | |
tree -fi | sed -r 's/\.\/|.md//g' | tail -n +2 | \ | |
while read CMD; do | |
echo '['$CMD']('$CMD')' | |
echo '' | |
done > list-files.md | |
#check the file length | |
numberLines=$(cat list-files.md | wc -l) | |
#remove the last not real link | |
sed -i $numberLines's/(.*)//' list-files.md | |
#remove the last line but one | |
numberLines=`expr $numberLines - 1` | |
sed -i $numberLines's/.*/\n/' list-files.md | |
#add result to Home.md | |
numberLines=$(cat Home.md | wc -l) | |
lineListPages=$(grep '#List pages' Home.md -ns | sed 's/:.*//g') | |
#if lineListPages does not exist | |
if ! [ -z "$lineListPages" ] | |
then | |
sed $lineListPages','$numberLines'd' Home.md -i | |
fi | |
echo '#List pages' >> Home.md | |
echo '' >> Home.md | |
cat list-files.md >> Home.md |
This file contains 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
#execute list-files to create index on Home.md | |
./list-files.sh | |
#git | |
git status | |
echo '' | |
echo '' | |
echo 'Press enter to continue' | |
read | |
git add . | |
git commit --all | |
git push --all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment