From 80d76362ccf92bd122a84b7827fcfadb7b4b6c07 Mon Sep 17 00:00:00 2001 From: Matteo Rossini Date: Sat, 8 Jan 2022 17:55:47 +0100 Subject: [PATCH] the "comma" syntax works with 'search' too --- src/slackpkgplus.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/slackpkgplus.sh b/src/slackpkgplus.sh index 6bf9cec..62954f5 100755 --- a/src/slackpkgplus.sh +++ b/src/slackpkgplus.sh @@ -1332,7 +1332,11 @@ if [ "$SLACKPKGPLUS" = "on" ];then }' l_dir=${DIR} > $PKGINFOS else # -- CMD==search - grep -h ${GREPOPTS} "^$DIR" ${TMPDIR}/pkglist ${TMPDIR}/pkglist-pre|grep -E ${GREPOPTS} "/SLACKPKGPLUS_$SEARCHSTR/|/$SEARCHSTR/|/$SEARCHSTR | [^ /]*$SEARCHSTR[^ /]* " > $PKGINFOS + if [[ "${SEARCHSTR}" =~ .*,$ ]];then + grep -h ${GREPOPTS} "^$DIR" ${TMPDIR}/pkglist ${TMPDIR}/pkglist-pre|grep -E ${GREPOPTS} "^[^ ]* ${SEARCHSTR%,} " > $PKGINFOS + else + grep -h ${GREPOPTS} "^$DIR" ${TMPDIR}/pkglist ${TMPDIR}/pkglist-pre|grep -E ${GREPOPTS} "/SLACKPKGPLUS_$SEARCHSTR/|/$SEARCHSTR/|/$SEARCHSTR | [^ /]*$SEARCHSTR[^ /]* " > $PKGINFOS + fi fi PKGTOPROCESS=$(cat $PKGINFOS|wc -l) PKGINPROGRES=0 @@ -1488,7 +1492,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then fi done|sort echo -en "\r" >&2 - }|column -t -s '#' -o ' '|( [[ "$CMD" == "search" ]]&&grep -E -i --color -e ^ -e "$PATTERN"||cat ) + }|column -t -s '#' -o ' '|( [[ "$CMD" == "search" ]]&&grep -E -i --color -e ^ -e "${PATTERN%,}"||cat ) } # END function searchlistEX() # Show detailed info for slackpkg info @@ -2386,12 +2390,12 @@ if [ "$SLACKPKGPLUS" = "on" ];then searchlistEX "$LIST" echo -e "\nYou can search specific files using \"slackpkg file-search file\".\n" fi - SBORESULT="$(grep -E -i "^SBO_[^ ]* [^ ]*$PATTERN" $WORKDIR/pkglist 2>/dev/null|awk '{print $6}')" + SBORESULT="$(grep -E -i "^SBO_[^ ]* [^ ]*${PATTERN/,/ }" $WORKDIR/pkglist 2>/dev/null|awk '{print $6}')" if [ ! -z "$SBORESULT" ];then echo echo "Also found in SBo (download it with 'slackpkg download '):" echo - echo -e "[package]\n$SBORESULT"|sed -e 's/ / /' -e 's/^/ /' -e 's/ \[/[ /g' -e 's/\]/ ]/g'|grep --color -E -i -e "$PATTERN" -e ^ + echo -e "[package]\n$SBORESULT"|sed -e 's/ / /' -e 's/^/ /' -e 's/ \[/[ /g' -e 's/\]/ ]/g'|grep --color -E -i -e "${PATTERN%,}" -e ^ echo fi ;;