Avoid exiting early when executing test for add_line
This commit is contained in:
parent
6cfc69a116
commit
f3d59be36e
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue