加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

shell脚本集合

发布时间:2020-12-15 16:48:05 所属栏目:安全 来源:网络整理
导读:#本人新手写的不好之处,一定要指点我。我会不定期更新这个内容。 1、输入IP地址查找/etc/hosts文件中指定的域名 #!/bin/sh#authorvperson#qq737304790#EnterthespecifiedIPtofindthecorrespondingdomainnameinthehostsfileflag=0if[$#-ne1]thenecho"Inputer

#本人新手写的不好之处,一定要指点我。我会不定期更新这个内容。

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"33[31m$1==>>`echo$line|awk'{print$2}'`33[0m"
			break
	fi
done

[${flag}-eq0]&&echo"NospecifiedIP"

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读