Browse Source

contrib: diffpatch.sh: validate arguments

pull/183/head
Marvin Scholz 9 months ago
committed by Steve Lhomme
parent
commit
c03ce27eec
  1. 9
      contrib/diffpatch.sh

9
contrib/diffpatch.sh

@ -2,4 +2,11 @@
# create a patch file based on file extension
# $1 folder to run the find in
# $2 extension to use for the diff
find $1 -name "*$2" -exec bash -c 'filepath="$1" ; dir=$(dirname "$filepath") ; base=$(basename -s $2 "$filepath") ; diff -pur $filepath $dir/$base' -- {} $2 \;
if [ "$#" -ne 2 ]; then
echo "expected two arguments" >&2
echo "usage: diffpatch.sh <package_folder> <file_extension_between_old_new_versions>" >&2
exit 2
fi
find $1 -name "*$2" -exec bash -c 'filepath="$1" ; dir=$(dirname "$filepath") ; base=$(basename -s $2 "$filepath") ; diff -pur $filepath $dir/$base' -- {} $2 \;

Loading…
Cancel
Save