#本人新手写的不好之处,一定要指点我。我会不定期更新这个内容。
1、输入IP地址查找/etc/hosts文件中指定的域名
#!/bin/sh #authorvperson #qq737304790 #EnterthespecifiedIPtofindthecorrespondingdomainnameinthehostsfile flag=0 if[$#-ne1] then echo"Inputerror" echo"Usage:$0127.0.0.1" exit1 fi exec</etc/hosts whilereadline do if["$1"="`echo$line|awk'{print$1}'`"] then flag=1 printf"Successfullyfindthedomainname!\n" echo-e"\033[31m$1==>>`echo$line|awk'{print$2}'`\033[0m" break fi done [${flag}-eq0]&&echo"NospecifiedIP"原文链接:https://www.f2er.com/bash/392368.html