Skip to content

Instantly share code, notes, and snippets.

@Hologos
Last active July 23, 2019 11:33
Show Gist options
  • Save Hologos/c2c78e72b6ada5e4b9b471dd9a0d7e22 to your computer and use it in GitHub Desktop.
Save Hologos/c2c78e72b6ada5e4b9b471dd9a0d7e22 to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
for if_name in $(ifconfig -l); do
if ! [[ "${if_name}" =~ ^en[0-9]+$ ]]; then
break
fi
for if_ip in $(ifconfig "${if_name}" | grep 'inet' | awk '{ print $2 }'); do
nslookup "${if_ip}" | grep 'name = ' | awk '{ print $4 }'
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment