shell查询手机号码归属地

2015-10-27 0 276
shell查询手机号码归属地
#!/bin/bash
regex="1([358][0-9]|45|47)[0-9]{4,8}"
str=`echo $1|egrep ^"$regex"$`
#判断输入是否是正确的手机号码格式,该字符串为空则说明格式错误
if [ $# -ne 1 ]; then
#判断位置参数个数
echo "Usage:querypn PhoneNumber"
else
	if [ -z $str ]; then
	echo "Invalid phone number!"
	else curl -s wap.ip138.com/sim_search.asp?mobile=$1|sed -n '15,16p'|sed 's#<br/>##g'
#查询并输出
	fi
fi

遇见资源网 shell shell查询手机号码归属地 http://www.ox520.com/17223.html

上一篇: 懒得写makefile
常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务