From a5bd8532bef7b8439a09490ba84d5ba803764b9b Mon Sep 17 00:00:00 2001 From: a1346054 <36859588+a1346054@users.noreply.github.com> Date: Sat, 18 Sep 2021 12:08:36 +0000 Subject: [PATCH] unify quoting style for echo --- connect_to_openvpn_with_token.sh | 74 +++++++++++++++--------------- connect_to_wireguard_with_token.sh | 46 +++++++++---------- get_region.sh | 44 +++++++++--------- get_token.sh | 8 ++-- port_forwarding.sh | 24 +++++----- run_setup.sh | 28 +++++------ 6 files changed, 112 insertions(+), 112 deletions(-) diff --git a/connect_to_openvpn_with_token.sh b/connect_to_openvpn_with_token.sh index a46fd39..3d19f78 100755 --- a/connect_to_openvpn_with_token.sh +++ b/connect_to_openvpn_with_token.sh @@ -54,25 +54,25 @@ adapter_check=$( ip a s tun06 2>&1 ) should_read="Device \"tun06\" does not exist" pid_filepath="/opt/piavpn-manual/pia_pid" if [[ $adapter_check != *"$should_read"* ]]; then - echo -e ${RED}The tun06 adapter already exists, that interface is required - echo -e for this configuration.${NC} + echo -e "${RED}The tun06 adapter already exists, that interface is required" + echo -e "for this configuration.${NC}" if [[ -f $pid_filepath ]]; then old_pid=$( cat "$pid_filepath" ) old_pid_name=$( ps -p "$old_pid" -o comm= ) if [[ $old_pid_name == "openvpn" ]]; then echo - echo -e It seems likely that process ${RED}"$old_pid"${NC} is an OpenVPN connection - echo that was established by using this script. Unless it is closed - echo you would not be able to get a new connection. + echo -e "It seems likely that process ${RED}$old_pid${NC} is an OpenVPN connection" + echo "that was established by using this script. Unless it is closed" + echo "you would not be able to get a new connection." echo -ne "Do you want to run ${RED}$ kill $old_pid${NC} (Y/n): " read -r close_connection fi if echo "${close_connection:0:1}" | grep -iq n; then - echo -e ${RED}Closing script. Resolve tun06 adapter conflict and run the script again. + echo -e "${RED}Closing script. Resolve tun06 adapter conflict and run the script again." exit 1 fi echo - echo -e ${GREEN}Killing the existing OpenVPN process and waiting 5 seconds...${NC} + echo -e "${GREEN}Killing the existing OpenVPN process and waiting 5 seconds...${NC}" kill "$old_pid" echo for i in {5..1}; do @@ -92,9 +92,9 @@ if [[ -f /proc/net/if_inet6 ]] && [[ $(sysctl -n net.ipv6.conf.all.disable_ipv6) -ne 1 || $(sysctl -n net.ipv6.conf.default.disable_ipv6) -ne 1 ]] then - echo -e ${RED}'You should consider disabling IPv6 by running:' - echo 'sysctl -w net.ipv6.conf.all.disable_ipv6=1' - echo -e 'sysctl -w net.ipv6.conf.default.disable_ipv6=1'${NC} + echo -e "${RED}You should consider disabling IPv6 by running:" + echo "sysctl -w net.ipv6.conf.all.disable_ipv6=1" + echo -e "sysctl -w net.ipv6.conf.default.disable_ipv6=1${NC}" fi # Check if the mandatory environment variables are set. @@ -102,25 +102,25 @@ if [[ -z $OVPN_SERVER_IP || -z $OVPN_HOSTNAME || -z $PIA_TOKEN || -z $CONNECTION_SETTINGS ]]; then - echo -e ${RED}'This script requires 4 env vars:' - echo 'PIA_TOKEN - the token used for authentication' - echo 'OVPN_SERVER_IP - IP that you want to connect to' - echo 'OVPN_HOSTNAME - name of the server, required for ssl' - echo 'CONNECTION_SETTINGS - the protocol and encryption specification' - echo ' - available options for CONNECTION_SETTINGS are:' - echo ' * openvpn_udp_standard' - echo ' * openvpn_udp_strong' - echo ' * openvpn_tcp_standard' - echo ' * openvpn_tcp_strong' + echo -e "${RED}This script requires 4 env vars:" + echo "PIA_TOKEN - the token used for authentication" + echo "OVPN_SERVER_IP - IP that you want to connect to" + echo "OVPN_HOSTNAME - name of the server, required for ssl" + echo "CONNECTION_SETTINGS - the protocol and encryption specification" + echo " - available options for CONNECTION_SETTINGS are:" + echo " * openvpn_udp_standard" + echo " * openvpn_udp_strong" + echo " * openvpn_tcp_standard" + echo " * openvpn_tcp_strong" echo - echo You can also specify optional env vars: + echo "You can also specify optional env vars:" echo "PIA_PF - enable port forwarding" echo "PAYLOAD_AND_SIGNATURE - In case you already have a port." echo - echo An easy solution is to just run get_region_and_token.sh - echo as it will guide you through getting the best server and - echo also a token. Detailed information can be found here: - echo -e https://github.com/pia-foss/manual-connections${NC} + echo "An easy solution is to just run get_region_and_token.sh" + echo "as it will guide you through getting the best server and" + echo "also a token. Detailed information can be found here:" + echo -e "https://github.com/pia-foss/manual-connections${NC}" exit 1 fi @@ -128,8 +128,8 @@ fi echo -n "Trying to write /opt/piavpn-manual/pia.ovpn..." mkdir -p /opt/piavpn-manual rm -f /opt/piavpn-manual/credentials /opt/piavpn-manual/route_info -echo "${PIA_TOKEN:0:62}"" -""${PIA_TOKEN:62}" > /opt/piavpn-manual/credentials || exit 1 +echo "${PIA_TOKEN:0:62} +${PIA_TOKEN:62}" > /opt/piavpn-manual/credentials || exit 1 chmod 600 /opt/piavpn-manual/credentials echo -e "${GREEN}OK!${NC}" @@ -168,9 +168,9 @@ echo "remote $OVPN_SERVER_IP $port $protocol" >> /opt/piavpn-manual/pia.ovpn if [[ $PIA_DNS != "true" ]]; then cp openvpn_config/openvpn_up.sh /opt/piavpn-manual/ cp openvpn_config/openvpn_down.sh /opt/piavpn-manual/ - echo -e ${RED}This configuration will not use PIA DNS.${NC} - echo If you want to also enable PIA DNS, please start the script - echo with the env var PIA_DNS=true. Example: + echo -e "${RED}This configuration will not use PIA DNS.${NC}" + echo "If you want to also enable PIA DNS, please start the script" + echo "with the env var PIA_DNS=true. Example:" echo $ OVPN_SERVER_IP=\""$OVPN_SERVER_IP"\" OVPN_HOSTNAME=\""$OVPN_HOSTNAME"\" \ PIA_TOKEN=\""$PIA_TOKEN"\" CONNECTION_SETTINGS=\""$CONNECTION_SETTINGS"\" \ PIA_PF=true PIA_DNS=true ./connect_to_openvpn_with_token.sh @@ -233,14 +233,14 @@ To disconnect the VPN, run: # This section will stop the script if PIA_PF is not set to "true". if [[ $PIA_PF != "true" ]]; then - echo If you want to also enable port forwarding, you can start the script: - echo -e $ ${GREEN}PIA_TOKEN="$PIA_TOKEN" \ - PF_GATEWAY="$gateway_ip" \ - PF_HOSTNAME="$OVPN_HOSTNAME" \ - ./port_forwarding.sh${NC} + echo "If you want to also enable port forwarding, you can start the script:" + echo -e "$ ${GREEN}PIA_TOKEN=$PIA_TOKEN" \ + "PF_GATEWAY=$gateway_ip" \ + "PF_HOSTNAME=$OVPN_HOSTNAME" \ + "./port_forwarding.sh${NC}" echo - echo The location used must be port forwarding enabled, or this will fail. - echo Calling the ./get_region script with PIA_PF=true will provide a filtered list. + echo "The location used must be port forwarding enabled, or this will fail." + echo "Calling the ./get_region script with PIA_PF=true will provide a filtered list." exit 1 fi diff --git a/connect_to_wireguard_with_token.sh b/connect_to_wireguard_with_token.sh index fd5bfbb..24bdcad 100755 --- a/connect_to_wireguard_with_token.sh +++ b/connect_to_wireguard_with_token.sh @@ -55,28 +55,28 @@ if [[ -f /proc/net/if_inet6 ]] && [[ $(sysctl -n net.ipv6.conf.all.disable_ipv6) -ne 1 || $(sysctl -n net.ipv6.conf.default.disable_ipv6) -ne 1 ]] then - echo 'You should consider disabling IPv6 by running:' - echo 'sysctl -w net.ipv6.conf.all.disable_ipv6=1' - echo 'sysctl -w net.ipv6.conf.default.disable_ipv6=1' + echo "You should consider disabling IPv6 by running:" + echo "sysctl -w net.ipv6.conf.all.disable_ipv6=1" + echo "sysctl -w net.ipv6.conf.default.disable_ipv6=1" fi # Check if the mandatory environment variables are set. if [[ -z $WG_SERVER_IP || -z $WG_HOSTNAME || -z $PIA_TOKEN ]]; then - echo -e ${RED}This script requires 3 env vars: - echo WG_SERVER_IP - IP that you want to connect to - echo WG_HOSTNAME - name of the server, required for ssl - echo PIA_TOKEN - your authentication token + echo -e "${RED}This script requires 3 env vars:" + echo "WG_SERVER_IP - IP that you want to connect to" + echo "WG_HOSTNAME - name of the server, required for ssl" + echo "PIA_TOKEN - your authentication token" echo - echo You can also specify optional env vars: + echo "You can also specify optional env vars:" echo "PIA_PF - enable port forwarding" echo "PAYLOAD_AND_SIGNATURE - In case you already have a port." echo - echo An easy solution is to just run get_region_and_token.sh - echo as it will guide you through getting the best server and - echo also a token. Detailed information can be found here: - echo -e https://github.com/pia-foss/manual-connections${NC} + echo "An easy solution is to just run get_region_and_token.sh" + echo "as it will guide you through getting the best server and" + echo "also a token. Detailed information can be found here:" + echo -e "https://github.com/pia-foss/manual-connections${NC}" exit 1 fi @@ -92,7 +92,7 @@ export pubKey # In case you didn't clone the entire repo, get the certificate from: # https://github.com/pia-foss/manual-connections/blob/master/ca.rsa.4096.crt # In case you want to troubleshoot the script, replace -s with -v. -echo Trying to connect to the PIA WireGuard API on "$WG_SERVER_IP"... +echo "Trying to connect to the PIA WireGuard API on $WG_SERVER_IP..." wireguard_json="$(curl -s -G \ --connect-to "$WG_HOSTNAME::$WG_SERVER_IP:" \ --cacert "ca.rsa.4096.crt" \ @@ -111,7 +111,7 @@ fi # get multi-hop running with both WireGuard and OpenVPN by playing with # these scripts. Feel free to fork the project and test it out. echo -echo Trying to disable a PIA WG connection in case it exists... +echo "Trying to disable a PIA WG connection in case it exists..." wg-quick down pia && echo -e "${GREEN}\nPIA WG connection disabled!${NC}" echo @@ -142,14 +142,14 @@ PublicKey = $(echo "$wireguard_json" | jq -r '.server_key') AllowedIPs = 0.0.0.0/0 Endpoint = ${WG_SERVER_IP}:$(echo "$wireguard_json" | jq -r '.server_port') " > /etc/wireguard/pia.conf || exit 1 -echo -e ${GREEN}OK!${NC} +echo -e "${GREEN}OK!${NC}" # Start the WireGuard interface. # If something failed, stop this script. # If you get DNS errors because you miss some packages, # just hardcode /etc/resolv.conf to "nameserver 10.0.0.242". echo -echo Trying to create the wireguard interface... +echo "Trying to create the wireguard interface..." wg-quick up pia || exit 1 echo echo -e "${GREEN}The WireGuard interface got created.${NC} @@ -163,14 +163,14 @@ To disconnect the VPN, run: # This section will stop the script if PIA_PF is not set to "true". if [[ $PIA_PF != "true" ]]; then - echo If you want to also enable port forwarding, you can start the script: - echo -e $ ${GREEN}PIA_TOKEN="$PIA_TOKEN" \ - PF_GATEWAY="$WG_SERVER_IP" \ - PF_HOSTNAME="$WG_HOSTNAME" \ - ./port_forwarding.sh${NC} + echo "If you want to also enable port forwarding, you can start the script:" + echo -e "$ ${GREEN}PIA_TOKEN=$PIA_TOKEN" \ + "PF_GATEWAY=$WG_SERVER_IP" \ + "PF_HOSTNAME=$WG_HOSTNAME" \ + "./port_forwarding.sh${NC}" echo - echo The location used must be port forwarding enabled, or this will fail. - echo Calling the ./get_region script with PIA_PF=true will provide a filtered list. + echo "The location used must be port forwarding enabled, or this will fail." + echo "Calling the ./get_region script with PIA_PF=true will provide a filtered list." exit 1 fi diff --git a/get_region.sh b/get_region.sh index 2590790..a2aceb2 100755 --- a/get_region.sh +++ b/get_region.sh @@ -147,7 +147,7 @@ if [[ $selectedRegion == "none" ]]; then # Test one server from each region to get the closest region. # If port forwarding is enabled, filter out regions that don't support it. if [[ $PIA_PF == "true" ]]; then - echo Port Forwarding is enabled, non-PF servers excluded. + echo "Port Forwarding is enabled, non-PF servers excluded." echo summarized_region_data="$( echo "$all_region_data" | jq -r '.regions[] | select(.port_forward==true) | @@ -158,7 +158,7 @@ if [[ $selectedRegion == "none" ]]; then .servers.meta[0].ip+" "+.id+" "+.name+" "+(.geo|tostring)' )" fi echo -e Testing regions that respond \ - faster than ${GREEN}"$MAX_LATENCY"${NC} seconds: + faster than "${GREEN}$MAX_LATENCY${NC}" seconds: selectedRegion="$(echo "$summarized_region_data" | xargs -I{} bash -c 'printServerLatency {}' | sort | head -1 | awk '{ print $2 }')" @@ -166,8 +166,8 @@ if [[ $selectedRegion == "none" ]]; then if [[ -z $selectedRegion ]]; then echo -e "${RED}No region responded within ${MAX_LATENCY}s, consider using a higher timeout." - echo For example, to wait 1 second for each region, inject MAX_LATENCY=1 like this: - echo -e $ MAX_LATENCY=1 ./get_region.sh${NC} + echo "For example, to wait 1 second for each region, inject MAX_LATENCY=1 like this:" + echo -e "$ MAX_LATENCY=1 ./get_region.sh${NC}" exit 1 else echo -e "A list of servers and connection details, ordered by latency can be @@ -192,7 +192,7 @@ bestServer_OU_hostname=$(echo "$regionData" | jq -r '.servers.ovpnudp[0].cn') if [[ $VPN_PROTOCOL == "no" ]]; then - echo -ne The $selectedOrLowestLatency region is ${GREEN}"$(echo "$regionData" | jq -r '.name')"${NC} + echo -ne "The $selectedOrLowestLatency region is ${GREEN}$(echo "$regionData" | jq -r '.name')${NC}" if echo "$regionData" | jq -r '.geo' | grep true > /dev/null; then echo " (geolocated region)." else @@ -216,9 +216,9 @@ fi # If no token exists, the script will check for login credentials to generate one if [[ -z $PIA_TOKEN ]]; then if [[ -z $PIA_USER || -z $PIA_PASS ]]; then - echo -e ${RED}If you want this script to automatically get an authentication - echo token, please add the variables PIA_USER and PIA_PASS. Example: - echo -e $ PIA_USER=p0123456 PIA_PASS=xxx ./get_region.sh${NC} + echo -e "${RED}If you want this script to automatically get an authentication" + echo "token, please add the variables PIA_USER and PIA_PASS. Example:" + echo -e "$ PIA_USER=p0123456 PIA_PASS=xxx ./get_region.sh${NC}" exit 0 fi ./get_token.sh @@ -232,12 +232,12 @@ fi # Connect with WireGuard and clear authentication token file and latencyList if [[ $VPN_PROTOCOL == "wireguard" ]]; then - echo The ./get_region.sh script got started with - echo -e ${GREEN}VPN_PROTOCOL=wireguard${NC}, so we will automatically connect to WireGuard, - echo by running this command: - echo -e $ ${GREEN}PIA_TOKEN="$PIA_TOKEN" \\ - echo WG_SERVER_IP="$bestServer_WG_IP" WG_HOSTNAME="$bestServer_WG_hostname" \\ - echo -e PIA_PF=$PIA_PF ./connect_to_wireguard_with_token.sh${NC} + echo "The ./get_region.sh script got started with" + echo -e "${GREEN}VPN_PROTOCOL=wireguard${NC}, so we will automatically connect to WireGuard," + echo "by running this command:" + echo -e "$ ${GREEN}PIA_TOKEN=$PIA_TOKEN \\" + echo "WG_SERVER_IP=$bestServer_WG_IP WG_HOSTNAME=$bestServer_WG_hostname \\" + echo -e "PIA_PF=$PIA_PF ./connect_to_wireguard_with_token.sh${NC}" echo PIA_PF=$PIA_PF PIA_TOKEN=$PIA_TOKEN WG_SERVER_IP=$bestServer_WG_IP \ WG_HOSTNAME=$bestServer_WG_hostname ./connect_to_wireguard_with_token.sh @@ -253,14 +253,14 @@ if [[ $VPN_PROTOCOL == openvpn* ]]; then serverIP=$bestServer_OT_IP serverHostname=$bestServer_OT_hostname fi - echo The ./get_region.sh script got started with - echo -e ${GREEN}VPN_PROTOCOL=$VPN_PROTOCOL${NC}, so we will automatically - echo connect to OpenVPN, by running this command: - echo -e $ ${GREEN}PIA_PF=$PIA_PF PIA_TOKEN="$PIA_TOKEN" \\ - echo OVPN_SERVER_IP="$serverIP" \\ - echo OVPN_HOSTNAME="$serverHostname" \\ - echo CONNECTION_SETTINGS=$VPN_PROTOCOL \\ - echo -e ./connect_to_openvpn_with_token.sh${NC} + echo "The ./get_region.sh script got started with" + echo -e "${GREEN}VPN_PROTOCOL=$VPN_PROTOCOL${NC}, so we will automatically" + echo "connect to OpenVPN, by running this command:" + echo -e "$ ${GREEN}PIA_PF=$PIA_PF PIA_TOKEN=$PIA_TOKEN \\" + echo " OVPN_SERVER_IP=$serverIP \\" + echo " OVPN_HOSTNAME=$serverHostname \\" + echo " CONNECTION_SETTINGS=$VPN_PROTOCOL \\" + echo -e " ./connect_to_openvpn_with_token.sh${NC}" echo PIA_PF=$PIA_PF PIA_TOKEN=$PIA_TOKEN \ OVPN_SERVER_IP=$serverIP \ diff --git a/get_token.sh b/get_token.sh index 4266428..f054b98 100755 --- a/get_token.sh +++ b/get_token.sh @@ -60,9 +60,9 @@ fi mkdir -p /opt/piavpn-manual if [[ -z $PIA_USER || -z $PIA_PASS ]]; then - echo If you want this script to automatically get a token from the Meta - echo service, please add the variables PIA_USER and PIA_PASS. Example: - echo $ PIA_USER=p0123456 PIA_PASS=xxx ./get_token.sh + echo "If you want this script to automatically get a token from the Meta" + echo "service, please add the variables PIA_USER and PIA_PASS. Example:" + echo "$ PIA_USER=p0123456 PIA_PASS=xxx ./get_token.sh" exit 1 fi @@ -81,7 +81,7 @@ if [[ $(echo "$generateTokenResponse" | jq -r '.status') != "OK" ]]; then exit fi -echo -e ${GREEN}OK! +echo -e "${GREEN}OK!" echo token=$(echo "$generateTokenResponse" | jq -r '.token') tokenExpiration=$(timeout_timestamp) diff --git a/port_forwarding.sh b/port_forwarding.sh index 4cb861c..0b98cda 100755 --- a/port_forwarding.sh +++ b/port_forwarding.sh @@ -34,15 +34,15 @@ check_tool jq # Check if the mandatory environment variables are set. if [[ -z $PF_GATEWAY || -z $PIA_TOKEN || -z $PF_HOSTNAME ]]; then - echo This script requires 3 env vars: - echo PF_GATEWAY - the IP of your gateway - echo PF_HOSTNAME - name of the host used for SSL/TLS certificate verification - echo PIA_TOKEN - the token you use to connect to the vpn services + echo "This script requires 3 env vars:" + echo "PF_GATEWAY - the IP of your gateway" + echo "PF_HOSTNAME - name of the host used for SSL/TLS certificate verification" + echo "PIA_TOKEN - the token you use to connect to the vpn services" echo - echo An easy solution is to just run get_region_and_token.sh - echo as it will guide you through getting the best server and - echo also a token. Detailed information can be found here: - echo https://github.com/pia-foss/manual-connections + echo "An easy solution is to just run get_region_and_token.sh" + echo "as it will guide you through getting the best server and" + echo "also a token. Detailed information can be found here:" + echo "https://github.com/pia-foss/manual-connections" exit 1 fi @@ -142,12 +142,12 @@ while true; do # This script will exit in 2 months, since the port will expire. export bind_port_response if [[ $(echo "$bind_port_response" | jq -r '.status') != "OK" ]]; then - echo -e "${RED}The API did not return OK when trying to bind port... Exiting." + echo -e "${RED}The API did not return OK when trying to bind port... Exiting.${NC}" exit 1 fi - echo -e Forwarded port'\t'${GREEN}"$port"${NC} - echo -e Refreshed on'\t'${GREEN}"$(date)"${NC} - echo -e Expires on'\t'${RED}"$(date --date="$expires_at")"${NC} + echo -e Forwarded port'\t'"${GREEN}$port${NC}" + echo -e Refreshed on'\t'"${GREEN}$(date)${NC}" + echo -e Expires on'\t'"${RED}$(date --date="$expires_at")${NC}" echo -e "\n${GREEN}This script will need to remain active to use port forwarding, and will refresh every 15 minutes.${NC}\n" # sleep 15 minutes diff --git a/run_setup.sh b/run_setup.sh index d3e7ee4..cad8777 100755 --- a/run_setup.sh +++ b/run_setup.sh @@ -130,7 +130,7 @@ if [[ $PIA_PF != "true" ]]; then PIA_PF="false" fi export PIA_PF -echo -e ${GREEN}PIA_PF=$PIA_PF${NC} +echo -e "${GREEN}PIA_PF=$PIA_PF${NC}" echo # Check for in-line definition of DISABLE_IPV6 and prompt for input @@ -143,8 +143,8 @@ if [[ -z $DISABLE_IPV6 ]]; then fi if echo "${DISABLE_IPV6:0:1}" | grep -iq n; then - echo -e ${RED}"IPv6 settings have not been altered. - "${NC} + echo -e "${RED}IPv6 settings have not been altered. + ${NC}" else echo -e "The variable ${GREEN}DISABLE_IPV6=$DISABLE_IPV6${NC}, does not start with 'n' for 'no'. ${GREEN}Defaulting to yes.${NC} @@ -155,13 +155,13 @@ ${GREEN}Defaulting to yes.${NC} echo -e "${RED}IPv6 has been disabled${NC}, you can ${GREEN}enable it again with: " echo "sysctl -w net.ipv6.conf.all.disable_ipv6=0" echo "sysctl -w net.ipv6.conf.default.disable_ipv6=0" - echo -e ${NC} + echo -e "${NC}" fi # Input validation and check for conflicting declarations of AUTOCONNECT and PREFERRED_REGION # If both variables are set, AUTOCONNECT has superiority and PREFERRED_REGION is ignored if [[ -z $AUTOCONNECT ]]; then - echo AUTOCONNECT was not declared. + echo "AUTOCONNECT was not declared." echo selectServer="ask" elif echo "${AUTOCONNECT:0:1}" | grep -iq f; then @@ -184,7 +184,7 @@ else echo else echo - echo AUTOCONNECT supersedes in-line definitions of PREFERRED_REGION. + echo "AUTOCONNECT supersedes in-line definitions of PREFERRED_REGION." echo -e "${RED}PREFERRED_REGION=$PREFERRED_REGION will be ignored.${NC} " PREFERRED_REGION="" @@ -287,7 +287,7 @@ For example, you can try 0.2 for 200ms allowed latency. else PREFERRED_REGION=$( awk 'NR == '"$serverSelection"' {print $2}' /opt/piavpn-manual/latencyList ) echo - echo -e ${GREEN}PREFERRED_REGION="$PREFERRED_REGION"${NC} + echo -e "${GREEN}PREFERRED_REGION=$PREFERRED_REGION${NC}" break fi done @@ -300,13 +300,13 @@ For example, you can try 0.2 for 200ms allowed latency. exit 1 fi else - echo -e ${GREEN}You will auto-connect to the server with the lowest latency.${NC} + echo -e "${GREEN}You will auto-connect to the server with the lowest latency.${NC}" echo break fi else # Validate in-line declaration of PREFERRED_REGION; if invalid remove input to initiate prompts - echo Region input is : "$PREFERRED_REGION" + echo "Region input is : $PREFERRED_REGION" export PREFERRED_REGION VPN_PROTOCOL=no ./get_region.sh if [[ $? != 1 ]]; then @@ -357,15 +357,15 @@ case $VPN_PROTOCOL in ;; esac export VPN_PROTOCOL -echo -e ${GREEN}VPN_PROTOCOL=$VPN_PROTOCOL" +echo -e "${GREEN}VPN_PROTOCOL=$VPN_PROTOCOL ${NC}" # Check for the required presence of resolvconf for setting DNS on wireguard connections setDNS="yes" if ! command -v resolvconf &>/dev/null && [[ $VPN_PROTOCOL == "wireguard" ]]; then - echo -e ${RED}The resolvconf package could not be found. - echo This script can not set DNS for you and you will - echo -e need to invoke DNS protection some other way.${NC} + echo -e "${RED}The resolvconf package could not be found." + echo "This script can not set DNS for you and you will" + echo -e "need to invoke DNS protection some other way.${NC}" echo setDNS="no" fi @@ -373,7 +373,7 @@ fi # Check for in-line definition of PIA_DNS and prompt for input if [[ $setDNS == "yes" ]]; then if [[ -z $PIA_DNS ]]; then - echo Using third party DNS could allow DNS monitoring. + echo "Using third party DNS could allow DNS monitoring." echo -n "Do you want to force PIA DNS ([Y]es/[n]o): " read -r setDNS echo