From 87147098dbfd7d500ad8c36efb131e75ce402e8b Mon Sep 17 00:00:00 2001 From: Matteo Rossini Date: Mon, 17 Feb 2020 11:11:57 +0100 Subject: [PATCH] https://www.linuxquestions.org/questions/slackware-14/slackpkg-1-8-a-4175669481/page4.html#post6090976 slackpkgplus-search-packages.patch.txt --- src/slackpkgplus.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/slackpkgplus.sh b/src/slackpkgplus.sh index 906c759..f21c0e4 100755 --- a/src/slackpkgplus.sh +++ b/src/slackpkgplus.sh @@ -1101,9 +1101,14 @@ if [ "$SLACKPKGPLUS" = "on" ];then for i in ${PRIORITY[@]}; do DIR="$i" + PAT="" if [[ "$DIR" =~ ^[-_[:alnum:]]+[:] ]] ; then # was if echo "$DIR" | grep -q "[a-zA-Z0-9]\+[:]" ; then DIR=${i/:*/} # was DIR=$(echo "$i" | cut -f1 -d":") - PAT=${i/*:/} + + # extract the pattern from $i, if and only if "$i" is to the syntax :. Without + # this, PAT would be set to $DIR when $i is to the syntax . + # + [[ "$DIR" =~ [:][:alnum:]+ ]] && PAT=${i/*:/} # when the current priority is of kind :, the loop must be short-circuited # when SEARCHSTR does not match PATTERN, otherwise, some packages could be mistakenly @@ -1258,7 +1263,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then echo " $STATUS# $REPO# $CINSTPKG" else - INSTPKG_REPO=$(grep -m 1 "$CINSTPKG" ${WORKDIR}/pkglist | cut -f1 -d" " | sed "s/SLACKPKGPLUS_//") + INSTPKG_REPO=$(grep -m 1 " $CINSTPKG " ${WORKDIR}/pkglist | cut -f1 -d" " | sed "s/SLACKPKGPLUS_//") if [ ! -z "$INSTPKG_REPO" ] && [ "$INSTPKG_REPO" != "$REPO" ] ; then CINSTPKG="$INSTPKG_REPO:$CINSTPKG"