Fixed getting vpn_remote_line if there are no spaces

This commit is contained in:
DyonR 2020-09-12 22:06:42 +02:00
parent 11404ae043
commit a668334f5b

View File

@ -117,7 +117,7 @@ if [[ $VPN_ENABLED == "yes" ]]; then
if [[ "${VPN_TYPE}" == "openvpn" ]]; then
export vpn_remote_line=$(cat "${VPN_CONFIG}" | grep -P -o -m 1 '(?<=^remote\s)[^\n\r]+' | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
else
export vpn_remote_line=$(cat "${VPN_CONFIG}" | grep -P -o -m 1 '(?<=^Endpoint\s)[^\n\r]+' | sed -e 's~^[=\ ]*~~')
export vpn_remote_line=$(cat "${VPN_CONFIG}" | grep -P -o -m 1 '(?<=^Endpoint)(\s{0,})[^\n\r]+' | sed -e 's~^[=\ ]*~~')
fi
if [[ ! -z "${vpn_remote_line}" ]]; then