Created
October 3, 2014 16:23
-
-
Save igilham/3cca2cd7bfaa7cd56383 to your computer and use it in GitHub Desktop.
Enable/Disable proxy settings defined elsewhere
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
#!/bin/bash | |
# Toggle proxy settings. | |
# It will be necessary to reload ${HOME}/.profile after running this. | |
USAGE="usage: ${0} on|off|status" | |
if [[ "d${PROXY_FILE}d" == "dd" ]]; then | |
echo "PROXY_FILE undefined" >&2 | |
exit 1 | |
fi | |
if [[ $# -ne 1 ]]; then | |
echo ${USAGE} >&2 | |
exit 1 | |
elif [[ "$1" == "status" ]]; then | |
if [[ -f "${PROXY_FILE}" ]]; then | |
echo "proxy ON" | |
else | |
echo "proxy OFF" | |
fi | |
elif [[ "$1" == "on" ]]; then | |
touch ${PROXY_FILE} | |
elif [[ "$1" == "off" ]]; then | |
if [[ -f ${PROXY_FILE} ]]; then | |
rm -f ${PROXY_FILE} | |
fi | |
else | |
echo ${USAGE} >&2 | |
exit 1 | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment