simple/tiny/fqdn

10 lines
227 B
Bash
Executable File

#!/bin/sh
[ $# -ge 2 ] && { echo "Usage: $0 [hostname]" >&2; exit 1; }
if [ $# -eq 1 ]
then
hostname=$1
else
hostname="`/bin/hostname`"
fi
/usr/bin/nslookup $hostname | /bin/grep Name: | /bin/sed -e 's/.* *//'