Use local variable more

This commit is contained in:
Felipe Santos 2023-01-16 23:36:56 -03:00
parent 43ce2bdbd9
commit 6a47c02e02

View File

@ -5,6 +5,7 @@
set -o errexit -o nounset -o pipefail set -o errexit -o nounset -o pipefail
function get_ip_and_port() { function get_ip_and_port() {
local ip_address
# Example: 192.168.1.10/24 # Example: 192.168.1.10/24
local ip_regex='^([0-9]{1,3}\.{3}[0-9]{1,3})/[0-9]{1,2}$' local ip_regex='^([0-9]{1,3}\.{3}[0-9]{1,3})/[0-9]{1,2}$'
if ip_address=$( if ip_address=$(
@ -21,6 +22,7 @@ function get_ip_and_port() {
return 0 return 0
fi fi
local webrtc_port
local port_regex='^([0-9]{1,5})$' local port_regex='^([0-9]{1,5})$'
if webrtc_port=$( if webrtc_port=$(
curl -fsSL \ curl -fsSL \