Shell Script Code
Go | Python | Bash | Ruby | Perl | PHP | Java Scripts
Pages
Home
Saturday, April 16, 2016
Get Hostname associated with ip address from /etc/hosts file
You need to add command line argument as mentioned in screenshot.
#!/bin/bash
#Developed By - Krunal Patel ( Linux Admin)
cat /etc/hosts | grep $1 | awk {'print $2,$3'}
No comments:
Post a Comment
Please give us suggestions.
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Please give us suggestions.