Skip to content

Instantly share code, notes, and snippets.

@dlemmon
Last active May 18, 2018 09:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlemmon/e5649259cb4ffa230f3e83ae93f19044 to your computer and use it in GitHub Desktop.
Save dlemmon/e5649259cb4ffa230f3e83ae93f19044 to your computer and use it in GitHub Desktop.
Set proxy variables from bash when you don't want to have the password hardcoded, or in a command history. Works in windows with git bash
#!/bin/bash
[[ $_ != $0 ]] && echo "Write your password:" ||
echo "You need to call this from the source command: source $(basename $0)"
PROTOCOL=http
USERNAME=myuser
HOST=proxy.bigevilcorporation.com
PORT=8009
read -s PASS
export http_proxy=$PROTOCOL://$USERNAME:$PASS@$HOST:$PORT
export https_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment