From bba4e1d71fd49064e1e44134b0a9a1f49839d6ff Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Thu, 30 Jan 2020 13:21:01 +0100 Subject: [PATCH] Fix ignore pattern search on empty ignore variable The default ignore pattern would not be searched when the additional variable was kept empty. This fixes it to always seach for the pattern, regardless of any other variables. --- bootstrap/autostow.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bootstrap/autostow.sh b/bootstrap/autostow.sh index b7dd038..3f72b14 100755 --- a/bootstrap/autostow.sh +++ b/bootstrap/autostow.sh @@ -78,18 +78,20 @@ dryrun() { printf "processing %s\n" "$d" done + echo "Done printing directories ................................................." } is_ignored() { IFS=":" for ign in $ignore; do # it is either passed in through our environment variable - # or it starts with a _ which is ignored by default (that's the regex). - # (using herestring to avoid cat>grep) - if [ "$ign" = "$1" ] || [ "$ign/" = "$1" ] || grep -q -e '^_[[:alnum:]]\{1,\}' <<<"$1"; then + if [ "$ign" = "$1" ] || [ "$ign/" = "$1" ]; then return 0 fi done + # or it starts with a _ which is ignored by default (that's the regex). + # (using herestring to avoid cat>grep) + if grep -q -e '^_[[:alnum:]]\{1,\}' <<<"$1"; then return 0; fi return 1 }