Skip to content

Instantly share code, notes, and snippets.

@Pagliacii
Last active September 22, 2021 11:25
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 Pagliacii/102a0d4c65c41cf5dea55233da655ac0 to your computer and use it in GitHub Desktop.
Save Pagliacii/102a0d4c65c41cf5dea55233da655ac0 to your computer and use it in GitHub Desktop.
A shell script to run command behind the proxy.
#!/usr/bin/env bash
# 0. (Optional) Rename this script name to "proxy"
# 1. Replace the <protocol>, <ip> and <port> to the actual value of your proxy respectively.
# 2. Run this command `sudo chmod +x <path to proxy>` to make sure this script is executable.
# 3. Add this script path to the PATH environment variable.
# 4. Run your actual command like this: `proxy ping www.google.com`.
PROXY="<protocol>://<ip>:<port>"
export ALL_PROXY=$PROXY
export HTTP_PROXY=$PROXY
export HTTPS_PROXY=$PROXY
export SOCKS_PROXY=$PROXY
export FTP_PROXY=$PROXY
export TELNET_PROXY=$PROXY
export RSYNC_PROXY=$PROXY
("${@}")
unset ALL_PROXY
unset HTTP_PROXY
unset HTTPS_PROXY
unset SOCKS_PROXY
unset FTP_PROXY
unset TELNET_PROXY
unset RSYNC_PROXY
@Mazakanull
Copy link

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment