Guest User

Untitled

a guest
Oct 20th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. function reculatexdiff
  4. {
  5. if [[ $# -ne 3 ]];
  6. then
  7. echo "Usage:"
  8. echo " mylatexdiff <folder1> <folder2> <folder3>"
  9. return
  10. fi
  11. if [ ! -d "$1" ];
  12. then
  13. echo "Directory $1 does not exists!"
  14. return
  15. fi
  16. if [ ! -d "$2" ];
  17. then
  18. echo "Directory $2 does not exists!"
  19. return
  20. fi
  21. echo "Removing $3..."
  22. rm -rf $3
  23. echo "Copying $1 in $3..."
  24. cp -rf $1 $3
  25. # [BASH] Uncomment to make sure globstar is enabled.
  26. # shopt -s globstar
  27. for file1 in $1/**/*.tex;
  28. do
  29. file1abs=$(echo $file1 | cut -d'/' -f2-)
  30. for file2 in $2/**/*.tex;
  31. do
  32. file2abs=$(echo $file2 | cut -d'/' -f2-)
  33. if [[ $file1abs == $file2abs ]];
  34. then
  35. echo "Generating difference for $file1abs..."
  36. latexdiff $file1 $file2 > $3/$file1abs
  37. fi
  38. done
  39. done
  40. }
Add Comment
Please, Sign In to add comment