From 3c91b6558dcc947736e1df1631a9a7dfc7d32f9b Mon Sep 17 00:00:00 2001 From: William Blew Date: Fri, 17 Mar 2023 11:47:26 -0700 Subject: [PATCH] restore the addKey comment, reworded for anchors Per @dschaper, restore the addKey clarifying comment. It has been reworded to describe the use of anchors where before it referenced using grep's 'match only an entire line' argument. Signed-off-by: William Blew --- advanced/Scripts/utils.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/advanced/Scripts/utils.sh b/advanced/Scripts/utils.sh index 9e714606..f655e56c 100755 --- a/advanced/Scripts/utils.sh +++ b/advanced/Scripts/utils.sh @@ -57,6 +57,10 @@ addKey(){ # touch file to prevent grep error if file does not exist yet touch "${file}" + # Match key against entire line, using both anchors. We assume + # that the file's keys never have bounding whitespace. Anchors + # are necessary to ensure the key is considered absent when it + # is a substring of another key present in the file. if ! grep -q "^${key}$" "${file}"; then # Key does not exist, add it. echo "${key}" >> "${file}"