Skip to content

Commit

Permalink
beesh: fix search for suggested revision number
Browse files Browse the repository at this point in the history
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
  • Loading branch information
donald committed Jul 20, 2016
1 parent 768565e commit 118648c
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/beesh.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 118648c

Please sign in to comment.