Fix issue with POSIX portability in proxyresolv script

This commit is contained in:
Douglas R Colkitt 2019-04-13 15:48:24 +00:00
parent 98e9326534
commit 0416c2b7ea

View File

@ -3,13 +3,12 @@
# DNS server used to resolve names
if [[ -z "$PROXY_DNS_SERVER" ]] ; then
if [ -z "$PROXY_DNS_SERVER" ] ; then
DNS_SERVER=208.67.222.222 # OpenDNS
else
DNS_SERVER=$PROXY_DNS_SERVER
fi
if [ $# = 0 ] ; then
echo " usage:"
echo " proxyresolv <hostname> "
@ -17,7 +16,7 @@ if [ $# = 0 ] ; then
fi
awk 'BEGIN{ARGC=0} {for(i=2;i<=NF;i++){if($i==ARGV[1] && $1!~":"){print $1;found=1}} } END{exit found?0:1}' "$1" </etc/hosts
if [[ "$?" -eq "0" ]]; then
if [ "$?" -eq "0" ]; then
exit
fi