From 3d5beef19e3db54fc6de0ce1ff3383480c0879e5 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Wed, 20 Jul 2016 13:03:59 +0200 Subject: [PATCH] beesh: fix search for suggested revision number This change reduces code, avoids a call to an external programm and does quoting correctly for all metacharacters We don't need to restore extglob to its former value, as this function doesn't return and we are about to exit --- src/beesh.sh.in | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/beesh.sh.in b/src/beesh.sh.in index 7a92759..52391b0 100644 --- a/src/beesh.sh.in +++ b/src/beesh.sh.in @@ -145,17 +145,11 @@ function check_rebuild() { print_warning "please increase revision number" - beefile_dir=${beefile%/*} eval $(${BEEVERSION} "${beefile}") beefile_pattern="${PKGFULLNAME}-${PKGFULLVERSION}" - beefile_pattern=${beefile_pattern//+/\\+} # replace all + with \+ - beefile_pattern=${beefile_pattern//./\\.} # replace all . with \. - - beefile_max=$(for bf in $(ls "${beefile%/*}/${beefile_pattern}*.bee" "${BEE_BEEDIR}/${beefile_pattern}*.bee" 2>/dev/null |\ - grep -E "/${beefile_pattern}-[0-9]+.bee") ; do - echo "${bf}" - done | ${BEESORT} | tail -1) + shopt -s extglob + beefile_max=$( ls "${beefile%/*}/${beefile_pattern}"-+([0-9]).bee "${BEE_BEEDIR}/${beefile_pattern}"-+([0-9]).bee 2>/dev/null | ${BEESORT} | tail -1) eval $(${BEEVERSION} ${beefile_max}) print_warning "cp ${beefile} ${PWD}/${PKGFULLNAME}-${PKGFULLVERSION}-$((PKGREVISION + 1)).bee"