Skip to content

Instantly share code, notes, and snippets.

@ebuildy
Created January 24, 2017 19:43
Show Gist options
  • Save ebuildy/8117d3c1748dc1f26d39d02fe1b8c4a7 to your computer and use it in GitHub Desktop.
Save ebuildy/8117d3c1748dc1f26d39d02fe1b8c4a7 to your computer and use it in GitHub Desktop.
Extract protocol, host and port from URL like "PROTOCOL://HOST:PORT"
PROXY_PROTOCOL=$(echo "${HTTP_PROXY%%:*}")
PROXY_HOST=$(echo "${HTTP_PROXY%:*}")
PROXY_HOST=$(echo "${PROXY_HOST##*/}")
PROXY_PORT=$(echo "${HTTP_PROXY##*:}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment