diff options
author | Guy Harris <guy@alum.mit.edu> | 2010-02-16 01:08:07 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2010-02-16 01:08:07 +0000 |
commit | 7712d64f42e2d7e1ace9a0be024747befda77685 (patch) | |
tree | f42503dfc6b519448ea717195af8c5ec7056b59b /tools/win-setup.sh | |
parent | ebe8dc121e42a87b389642e4820bde9a18ecdde8 (diff) |
At least part of the problem is that Bash's test command appears not to
do short-circuit evaluation, so you can't do
if [ {test 1} -a {test that's not safe if test1 is false} ]
then
...
fi
so don't do that.
svn path=/trunk/; revision=31894
Diffstat (limited to 'tools/win-setup.sh')
-rwxr-xr-x | tools/win-setup.sh | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/tools/win-setup.sh b/tools/win-setup.sh index 2d6022ac5a..c6a7ac0165 100755 --- a/tools/win-setup.sh +++ b/tools/win-setup.sh @@ -54,20 +54,23 @@ find_proxy() { fi # ...and wget can't fetch two registry keys because...? + proxy_enabled=`regtool get /HKCU/Software/Microsoft/Windows/CurrentVersion/Internet\ Settings/ProxyEnable 2>/dev/null | tr -d '\012'` # - # If regtool prints a blank line, $proxy_enabled will - # not be a zero-length string, it'll be a newline. - # Strip out newlines so that doesn't happen. + # Bash's test command appears not to use short-circuit evaluation, + # so # - proxy_enabled=`regtool get /HKCU/Software/Microsoft/Windows/CurrentVersion/Internet\ Settings/ProxyEnable 2>/dev/null | tr -d '\012'` -if [ -n "$proxy_enabled" ] ; then -echo "proxy_enabled is $proxy_enabled" -echo "In raw bytes, that's:" -echo -n "$proxy_enabled" | od -bc -fi - if [ -n "$proxy_enabled" -a "$proxy_enabled" -ne 0 ] ; then - export http_proxy=`regtool get /HKCU/Software/Microsoft/Windows/CurrentVersion/Internet\ Settings/ProxyServer 2>/dev/null` - echo "Using Internet Explorer proxy settings." + # -n "$proxy_enabled" -a "$proxy_enabled" -ne 0 + # + # causes a complaint if "$proxy_enabled" is an empty string - + # the first test fails, but the second test is done anyway, + # and generates a complaint about the LHS of -ne not being + # numeric. Therefore, we do the tests separately. + # + if [ -n "$proxy_enabled" ] ; then + if [ "$proxy_enabled" -ne 0 ] ; then + export http_proxy=`regtool get /HKCU/Software/Microsoft/Windows/CurrentVersion/Internet\ Settings/ProxyServer 2>/dev/null` + echo "Using Internet Explorer proxy settings." + fi fi if [ -z "$http_proxy" -a -z "$HTTP_PROXY" ] ; then |