From 992bb4df4015417dd1fcdf1a9e4fd89dbcd8a6f0 Mon Sep 17 00:00:00 2001 From: Petr Nyc Date: Fri, 3 Mar 2023 15:24:18 +0100 Subject: [PATCH] script for setting proxy env variables --- bin/proxy | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 bin/proxy diff --git a/bin/proxy b/bin/proxy new file mode 100755 index 0000000..3dc1cc4 --- /dev/null +++ b/bin/proxy @@ -0,0 +1,29 @@ +# +# This script sets up http_proxy and https_proxy environment variables +# when the first positional command line parameter is 'on' +# and unsets them when the first positional command line parameter is 'off' +# +# +# usage: +# source proxy off +# source proxy on + +conffile="$HOME/.proxies" + +if [ "$1" = "on" ]; then + if [ -f "$conffile" ]; then + source "${conffile}" + export http_proxy https_proxy + echo "https_proxy: ${https_proxy}" + echo "http_proxy: ${http_proxy}" + else + echo "create $conffile" + fi +elif [ "$1" = "off" ]; then + unset http_proxy https_proxy + echo "Proxy is off" +fi + + +# vim formatting +# vim: set ts=4 sw=4 tw=0 noet ft=bash: