Guest User

Untitled

a guest
Oct 20th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. PREFIX=wiki
  4. FILES=$(find . -type f -iname '*.md' -o -iname '*.markdown')
  5.  
  6. if [[ "$1" == "revert" ]]; then
  7. # To Parse back to normal local [[links]]
  8. for file in $FILES; do
  9. sed -e 's/\[\(.*\)\](\/$PREFIX\/\(.*\))/[[\1]]/g' $file > $file.tmp
  10. mv $file.tmp $file
  11. done
  12. else
  13. # Rename local [[links]] to regular links.
  14. for file in $FILES; do
  15. sed -e 's/\[\[\(.*\)\]\]/[\1](\/$PREFIX\/\1)/g' $file > $file.tmp
  16. mv $file.tmp $file
  17. done
  18. fi
Add Comment
Please, Sign In to add comment