jeff-j of meraki
7/13/2015 - 11:32 PM

This script returns returns Network Services (in order) and the IPv4 address for each.

This script returns returns Network Services (in order) and the IPv4 address for each.

#!/bin/bash

# meraki systems manager compatible
# view network interface status

networksetup -listnetworkserviceorder | grep -E "^(\(\d*\))" | cut -f2- -d" " | 
while read SERVICE; do
  IP=$(networksetup -getinfo "$SERVICE" | grep -E "^IP address: \d{1,2}.\d{1,2}.\d{1,2}.\d{1,2}" | awk '{ print $3 }')
  [ ! -z $IP ] && echo "$SERVICE: $IP"
done