From 118648c2d80e2c612113076d66e60d4602b31cd7 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 03cffcf..b9098ce 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"