wg-quick: allow config files without trailing newline

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2017-02-22 20:23:00 +01:00
parent b20702bfa3
commit a9bcd0d401
1 changed files with 1 additions and 1 deletions

View File

@ -31,7 +31,7 @@ parse_options() {
((($(stat -c '%#a' "$CONFIG_FILE") & 0007) == 0)) || echo "Warning: \`$CONFIG_FILE' is world accessible" >&2 ((($(stat -c '%#a' "$CONFIG_FILE") & 0007) == 0)) || echo "Warning: \`$CONFIG_FILE' is world accessible" >&2
INTERFACE="${BASH_REMATCH[1]}" INTERFACE="${BASH_REMATCH[1]}"
shopt -s nocasematch shopt -s nocasematch
while read -r line; do while read -r line || [[ -n $line ]]; do
key="${line%%=*}"; key="${key##*( )}"; key="${key%%*( )}" key="${line%%=*}"; key="${key##*( )}"; key="${key%%*( )}"
value="${line#*=}"; value="${value##*( )}"; value="${value%%*( )}" value="${line#*=}"; value="${value##*( )}"; value="${value%%*( )}"
[[ $key == "["* ]] && interface_section=0 [[ $key == "["* ]] && interface_section=0