Browse Source

improved last line handling

main
deicidus 1 year ago
parent
commit
6c516e8f00
  1. 2
      spells/menu/bitcoin/configure-bitcoin

2
spells/menu/bitcoin/configure-bitcoin

@ -44,7 +44,7 @@ fi
modify_bitcoin_conf() {
local key=$1
local value=$2
awk -v key="$key" -v value="$value" 'BEGIN {found=0} !/^#/ && $1==key {found=1; print key"="value; next} {print} END {if (!found) print key"="value}' "$bitcoin_conf" > "$bitcoin_conf.tmp" && mv "$bitcoin_conf.tmp" "$bitcoin_conf" || retry_with_sudo mv "$bitcoin_conf.tmp" "$bitcoin_conf"
awk -v key="$key" -v value="$value" 'BEGIN {found=0} !/^#/ && $1==key {found=1; print key"="value; next} {print} END {if (!found) print key"="value; print ""}' "$bitcoin_conf" > "$bitcoin_conf.tmp" && mv "$bitcoin_conf.tmp" "$bitcoin_conf" || retry_with_sudo mv "$bitcoin_conf.tmp" "$bitcoin_conf"
}
# Pruning question and storage amount

Loading…
Cancel
Save