[pacman-dev] [PATCH] pacdiff - merge just the newest .pacsave
Merge just the newest .pacsave, warn about any .pacsave.N files at the end Signed-off-by: Jonathan Frazier <eyeswide@gmail.com> --- contrib/pacdiff.sh.in | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/contrib/pacdiff.sh.in b/contrib/pacdiff.sh.in index ee80c9c..a24a7c9 100644 --- a/contrib/pacdiff.sh.in +++ b/contrib/pacdiff.sh.in @@ -107,12 +107,21 @@ cmd() { fi } +declare -a oldsaves + # see http://mywiki.wooledge.org/BashFAQ/020 while IFS= read -u 3 -r -d '' pacfile; do file="${pacfile%.pac*}" file_type="pac${pacfile##*.pac}" + # add matches for pacsave.N to oldsaves array, do not prompt + if [ "${file_type%%[[:digit:]]*}" == "pacsave." ]; then + oldsaves+=("$pacfile") + continue + fi + msg "%s file found for %s" "$file_type" "$file" + if [ ! -f "$file" ]; then warning "$file does not exist" rm -iv "$pacfile" @@ -139,6 +148,8 @@ while IFS= read -u 3 -r -d '' pacfile; do fi done 3< <(cmd) +(( ${#oldsaves[@]} > 0 )) && warning "Ignoring %s" "${oldsaves[@]}" + exit 0 # vim: set ts=2 sw=2 noet: -- 1.8.3.1
participants (1)
-
Jonathan Frazier