Skip to content

Instantly share code, notes, and snippets.

@acidprime
Created March 23, 2012 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acidprime/2175933 to your computer and use it in GitHub Desktop.
Save acidprime/2175933 to your computer and use it in GitHub Desktop.
domain_name from dhcp_packet of first active network interface https://jamfnation.jamfsoftware.com/discussion.html?id=4112
#!/bin/bash
#set -x
declare -x ipconfig="/usr/sbin/ipconfig"
for (( N = 0 ; N <=3; N++ )) ; do
declare DOMAIN_NAME="$($ipconfig getoption en$N domain_name 2>/dev/null)"
[ "${#DOMAIN_NAME}" -gt 0 ] && break
done
printf "<result>%s</result>\n" "$DOMAIN_NAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment