Skip to content

Instantly share code, notes, and snippets.

@mapi68
Last active November 14, 2023 05:19
Show Gist options
  • Save mapi68/9cdb340319a15a94ba1f33f23109a408 to your computer and use it in GitHub Desktop.
Save mapi68/9cdb340319a15a94ba1f33f23109a408 to your computer and use it in GitHub Desktop.
This Bash script prompts the user to input a DNS name, and then uses the dig command to retrieve and display the corresponding IP address
#!/bin/bash
tput clear
echo
echo "********************* Hello $USER! *********************"
echo
echo "Please paste DNS name that you want to convert into IP:"
read A
echo
echo "IP of $A is: `dig $A | awk '/^;; ANSWER SECTION:$/ { getline ; print $5 }'`"
echo
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment