From b5fcf1ad0c1b90dc354b9c0f3d81fbda31ba9a71 Mon Sep 17 00:00:00 2001 From: Markus Ressel Date: Tue, 29 Mar 2022 03:41:31 +0200 Subject: [PATCH] -F, --fixed-strings PATTERNS are strings (#8) -x, --line-regexp match only whole lines --- zfs-inplace-rebalancing.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zfs-inplace-rebalancing.sh b/zfs-inplace-rebalancing.sh index bf41d75..f29eb70 100755 --- a/zfs-inplace-rebalancing.sh +++ b/zfs-inplace-rebalancing.sh @@ -40,7 +40,7 @@ function color_echo () { function get_rebalance_count () { file_path=$1 - line_nr=$(grep -n "${file_path}" "./${rebalance_db_file_name}" | head -n 1 | cut -d: -f1) + line_nr=$(grep -xF -n "${file_path}" "./${rebalance_db_file_name}" | head -n 1 | cut -d: -f1) if [ -z "${line_nr}" ]; then echo "0" return @@ -161,7 +161,7 @@ function rebalance () { if [ "${passes_flag}" -ge 1 ]; then # update rebalance "database" - line_nr=$(grep -n "${file_path}" "./${rebalance_db_file_name}" | head -n 1 | cut -d: -f1) + line_nr=$(grep -xF -n "${file_path}" "./${rebalance_db_file_name}" | head -n 1 | cut -d: -f1) if [ -z "${line_nr}" ]; then rebalance_count=1 echo "${file_path}" >> "./${rebalance_db_file_name}"