Files
gists/proxy/get_proxy.sh
2019-11-19 15:00:31 +01:00

22 lines
482 B
Bash

#!/bin/bash
proxy_ip=$(env | grep http_proxy | grep -Pio '[^@/:]+(?=:\d+/?$)')
proxy_port=$(env | grep http_proxy | grep -Pio '(?<=:)(\d+)(?=/?$)')
if [ -z "${proxy_ip}" ]; then
echo "Enter Proxy IP or Hostname (no port): "
read proxy_ip
else
echo "Using >>${proxy_ip}<< as Proxy-Address"
fi
if [ -z "${proxy_port}" ]; then
echo -n "Proxy-Port: "
read proxy_port
else
echo "Using >>${proxy_port}<< as Proxy-Port"
fi
echo "Using ${proxy_ip}:${proxy_port} as Proxy!"