I am trying to create 2 scripts. One for setting local enviroment variables, and the other for unsetting local enviroment varibales.
Firstly, both scripts were created under the following commands:
touch set-proxy.sh
touch unset-proxy.sh
Then I made both of them executable:
chmod 700 set-proxy.sh
chmod 700 unset-proxy.sh
Then I went into the set-proxy.sh
file and put the following inside:
#!/bin/bash
`export HTTP_PROXY=http://nick:nick@proxy.***.***.com:****`
`export HTTPS_PROXY=http://nick:nick@proxy.***.***.com:****`
`export HTTP-PROXY=http://nick:nick@proxy.***.***.com:****`
`export HTTPS-PROXY=http://nick:nick@proxy.***.***.com:****`
`export http_proxy=http://nick:nick@proxy.***.***.com:****`
`export https_proxy=http://nick:nick@proxy.***.***.com:****`
`export http-proxy=http://nick:nick@proxy.***.***.com:****`
`export https-proxy=http://nick:nick@proxy.***.***.com:****`
Then I went inside the unset-proxy.sh
file and put the following inside:
#!/bin/bash
`unset HTTP_PROXY`
`unset HTTPS_PROXY`
`unset HTTP-PROXY`
`unset HTTPS-PROXY`
`unset http_proxy`
`unset https_proxy`
`unset http-proxy`
`unset https-proxy`
I pretty much need a quick way to unset and set all proxy configuration. I thought creating two scripts would be the simplest way.
However, when I run ./unset-proxy.sh
or ./set-proxy.sh
I get the following error messages:
./unset-proxy: line 5: unset: `HTTP-PROXY': not a valid identifier
./unset-proxy: line 6: unset: `HTTPS-PROXY': not a valid identifier
./unset-proxy: line 9: unset: `http-proxy': not a valid identifier
./unset-proxy: line 10: unset: `https-proxy': not a valid identifier
(Then I get the same with the set-proxy.sh
as well).
If someone could help point me in the right direction of what I am doing wrong and how I can correct it, would be super appreciated. Thanks.
./unset-proxy: line 5: unset:
– user257636 Oct 27 '17 at 01:32HTTP-PROXY': not a valid identifier ./unset-proxy: line 6: unset:
HTTPS-PROXY': not a valid identifier ./unset-proxy: line 9: unset:http-proxy': not a valid identifier ./unset-proxy: line 10: unset:
https-proxy': not a valid identifier./script
(which creates its own process, which then goes away) versus. ./script
(which runs the code within the context of the current process) – thrig Oct 27 '17 at 01:33. ./unset-proxy
i get the same error but in a different format:-bash: unset:
HTTP-PROXY': not a valid identifier` – user257636 Oct 27 '17 at 01:35-
, there must be a way to put-
in a shell script, well i would have thought anyways. – user257636 Oct 27 '17 at 01:40