Last active
September 22, 2021 11:25
-
-
Save Pagliacii/102a0d4c65c41cf5dea55233da655ac0 to your computer and use it in GitHub Desktop.
A shell script to run command behind the proxy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
good