#!/bin/bash
##########################################################################
# Shellscript : List all Networks and Status for AutoProxy
# Autor : NEXT Enterprise gmbh, 2021
##########################################################################
# set -x
IFS=$'\n'
for i in $(networksetup -listallnetworkservices | tail +2 );
do
status=$(networksetup -getproxyautodiscovery "$i" | awk '{print $NF}' 2>/dev/null )
if [[ "$status" == "Off" ]]; then
DisabledAutoProxy+=("$i")
else
EnabledAutoProxy+=("$i")
fi
done
if [[ -z "${DisabledAutoProxy[@]}" ]]; then
echo "On"
else
echo "Off"
fi
unset IFS