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 authored and mariux committed Jul 21, 2016
1 parent b6f67d0 commit 17fe79e
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 @@ -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))"
Expand Down

0 comments on commit 17fe79e

Please sign in to comment.