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>
pull/5211/head
William Blew 1 year ago
parent b9a6970bfd
commit 3c91b6558d
No known key found for this signature in database
GPG Key ID: CCCB3B7C59CC092C

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

Loading…
Cancel
Save