From ee02e2641fab87198d3998adaf2e120dc2770b50 Mon Sep 17 00:00:00 2001 From: NRK Date: Wed, 2 Jun 2021 02:11:54 +0600 Subject: [PATCH] list: simplify QUERY_TITLE parsing logic --- sxbm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sxbm b/sxbm index 9263158..41de4cf 100755 --- a/sxbm +++ b/sxbm @@ -108,21 +108,18 @@ bm_list(){ [ -z "$QUERY_TAG" ] && QUERY_TAG="/[[:blank:]]\\$1($| )/" || QUERY_TAG="${QUERY_TAG} $QUERY_STRICT /[[:blank:]]\\$1($| )/" - shift ;; *) - if [ "$QUERY_STRICT" = "&&" ]; then - [ -z "$QUERY_TITLE" ] && - QUERY_TITLE="grep -i -e \"$1\"" || - QUERY_TITLE="${QUERY_TITLE} | grep -i -e \"$1\"" + if [ -z "$QUERY_TITLE" ]; then + QUERY_TITLE="grep -i -e \"$1\"" else - [ -z "$QUERY_TITLE" ] && - QUERY_TITLE="grep -i -e \"$1\"" || + [ "$QUERY_STRICT" = "&&" ] && + QUERY_TITLE="${QUERY_TITLE} | grep -i -e \"$1\"" || QUERY_TITLE="${QUERY_TITLE} -e \"$1\"" fi - shift ;; esac + shift done [ -z "$QUERY_TITLE" ] &&