#!/bin/bash IFS=$'\n' unset GLOBIGNORE locations=($(networksetup -listlocations)) #echo $locations echo "${locations[@]}" default=$(networksetup -getcurrentlocation) for target in "${default[@]}"; do for i in "${!locations[@]}"; do if [[ ${locations[i]} = $target ]]; then unset 'locations[i]' fi done done echo "${locations[1]}" for i in "${locations[@]}"; do networksetup -deletelocation "$i" 1> /dev/null echo "Netzwerk-Umgebung" "$i" "wurde gelöscht" done # Detects all network hardware & creates services for all installed network hardware /usr/sbin/networksetup -detectnewhardware /usr/sbin/networksetup -createnetworkservice "USB 10/100/1000 LAN" "USB 10/100/1000 LAN" /usr/sbin/networksetup -createnetworkservice "Wi-Fi" "Wi-Fi" #Loops through the list of network services for i in $(networksetup -listallnetworkservices | tail +2 ); do # Enable http proxy /usr/sbin/networksetup -setwebproxy "$i" "$4" "$5" echo "Turned on http proxy for $i" # Enable https proxy /usr/sbin/networksetup -setsecurewebproxy "$i" "$4" "$5" echo "Turned on https proxy for $i" # Set proxy bypass domain /usr/sbin/networksetup -setproxybypassdomains "$i" "$6" echo "Turned on bypass url for $i" # Disable IPv6 /usr/sbin/networksetup -setv6off "$i" echo "Turned off ipv6 for $i" done unset IFS