Guest User

Untitled

a guest
Nov 14th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #!/bin/bash
  2. SRC_ORIG="$1"
  3. SRC_NEW="$2"
  4. PATCH_NAME="$3"
  5.  
  6. if [[ -z $3 ]]; then
  7. echo -e "\n error! syntax is:\n\n $0 ORIGINAL MODIFIED PATCH_NAME\n"
  8. exit
  9. fi
  10.  
  11. if [[ -d $SRC_ORIG ]] && [[ -d $SRC_NEW ]]; then
  12. INTYPE="DIR"
  13. elif [[ -f $SRC_ORIG ]] && [[ -f $SRC_NEW ]]; then
  14. INTYPE="FILE"
  15. else
  16. echo -e "\n error!\n\n use either directories or files to create a patch.\n"
  17. exit
  18. fi
  19.  
  20. if [[ $INTYPE == "FILE" ]]; then
  21. diff -Naru $SRC_ORIG $SRC_NEW > $PATCH_NAME
  22. elif [[ $INTYPE == "DIR" ]]; then
  23. diff -crB $SRC_ORIG $SRC_NEW > $PATCH_NAME
  24. fi
Add Comment
Please, Sign In to add comment