From 17fe79e4c6decf92586f371e431205da6adb9a61 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 744153d..7231b61 100644 --- a/src/beesh.sh.in +++ b/src/beesh.sh.in @@ -141,17 +141,11 @@ function check_rebuild() { return 0 fi - 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 "please increase revision number to $((PKGREVISION + 1))"