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 <william@kulian.org>
This commit is contained in:
William Blew 2023-03-17 11:47:26 -07:00
parent b9a6970bfd
commit 3c91b6558d
No known key found for this signature in database
GPG key ID: CCCB3B7C59CC092C

View file

@ -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}"