From a9bcd0d4017a168c5c277a6804bad081123b973a Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 22 Feb 2017 20:23:00 +0100 Subject: [PATCH] wg-quick: allow config files without trailing newline Signed-off-by: Jason A. Donenfeld --- src/wg-quick.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wg-quick.bash b/src/wg-quick.bash index 275594e..ccf27a9 100755 --- a/src/wg-quick.bash +++ b/src/wg-quick.bash @@ -31,7 +31,7 @@ parse_options() { ((($(stat -c '%#a' "$CONFIG_FILE") & 0007) == 0)) || echo "Warning: \`$CONFIG_FILE' is world accessible" >&2 INTERFACE="${BASH_REMATCH[1]}" shopt -s nocasematch - while read -r line; do + while read -r line || [[ -n $line ]]; do key="${line%%=*}"; key="${key##*( )}"; key="${key%%*( )}" value="${line#*=}"; value="${value##*( )}"; value="${value%%*( )}" [[ $key == "["* ]] && interface_section=0