7

Output breaking when returning multiple values

view full story
linux-howto

http://www.unix.com – I've been trying to write a command-line function to grab a website's MX records and their ip addresses. The code below works with domains that only have one MX record: Code: function kmx { mx=`host -t MX $1 | awk '{ print $7 }'`; ip=`host $mx | sed '/IPv6/d;/handled/d' | awk '{ print $4 }'`; kdialog --title "KMX" --msgbox "# host -t MX $1 $mx    $ip";}; kmx clone-ozone.com However, changing the function parameter at the end to google.com or a domain with multiple MX Records breaks the output of the ip addresses. Tried messing with some arrays and diff (HowTos)