Skip to content

Instantly share code, notes, and snippets.

@Pagliacii

Pagliacii/proxy.sh

Last active Feb 7, 2021
Embed
What would you like to do?
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`.
export ALL_PROXY=<protocol>://<ip>:<port>
export HTTP_PROXY=<protocol>://<ip>:<port>
export HTTPS_PROXY=<protocol>://<ip>:<port>
export SOCKS_PROXY=<protocol>://<ip>:<port>
export FTP_PROXY=<protocol>://<ip>:<port>
export TELNET_PROXY=<protocol>://<ip>:<port>
("${@}")
unset ALL_PROXY
unset HTTP_PROXY
unset HTTPS_PROXY
unset SOCKS_PROXY
unset FTP_PROXY
unset TELNET_PROXY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment