Avoid exiting early when executing test for add_line

This commit is contained in:
ViViDboarder 2023-03-08 14:58:05 -08:00
parent 6cfc69a116
commit f3d59be36e

7
helpers/default Normal file → Executable file
View File

@ -377,14 +377,13 @@ run_as () {
add_line () { add_line () {
local line="$1" local line="$1"
local file="$2" local file="$2"
grep "$line" "$file" > /dev/null 2>&1
# shellcheck disable=2181 # shellcheck disable=2181
if [ $? -ne 0 ]; then if grep "$line" "$file" > /dev/null 2>&1; then
log "'$line' already in '$file'. Skipping."
else
log "Adding '$line' to '$file'..." log "Adding '$line' to '$file'..."
echo "$line" >> "$file" echo "$line" >> "$file"
else
log "'$line' already in '$file'. Skipping."
fi fi
} }