[fix] Don't run tr on a string again

This commit is contained in:
William Wernert
2020-05-26 16:41:41 -04:00
parent 8d684a0341
commit 00681649bd

View File

@@ -967,7 +967,7 @@ parse_options() {
proxy=$(echo "$1" | tr -d '"' | awk -F'--proxy=' '{print $2}') proxy=$(echo "$1" | tr -d '"' | awk -F'--proxy=' '{print $2}')
local proxy_protocol local proxy_protocol
proxy_protocol=$(echo "$proxy" |tr -d '"' | awk 'match($0, /http|https/) { print substr($0, RSTART, RLENGTH) }') proxy_protocol=$(echo "$proxy" | awk 'match($0, /http|https/) { print substr($0, RSTART, RLENGTH) }')
if [[ ! $proxy_protocol =~ ^(http|https)$ ]]; then if [[ ! $proxy_protocol =~ ^(http|https)$ ]]; then
echo "Invalid proxy protocol" echo "Invalid proxy protocol"