shell脚本实现获取图片

本文介绍如何利用Shell脚本进行批量图片处理,包括获取、重命名和转换图片格式等操作,帮助提升工作效率。
摘要由CSDN通过智能技术生成
#!/usr/bin/bash
. /etc/init.d/functions
function check(){
	time=`date "+%F %X"`
	echo "当前时间:$time"
	ip=$(ip a |grep inet |grep "scope global dynamic"|awk -F"/" '{print $1}' |awk '{print $2}')
	ping -w1 -c1 www.baidu.com &>/dev/null
	if [[ $? -ne 0 ]];then
		echo_failure || echo "网络异常,请检查"
	else
		echo_success && echo "网络正常 当前IP:$ip"
	fi
	yum repolist &>/dev/null
	if [[ $? -ne 0 ]];then
		echo_failure || echo "yum异常,请检查"
	fi
}

function down(){
	yum install -y wget &>/dev/null
	w=`echo "$1" |tr -d '\n' |od -An -tx1|tr ' ' %`
	data=$(curl -s "https://image.baidu.com/search/index?tn=baiduimage&word=$w")
	echo $data | grep -P -o "https://ss.*?.jpg" | sort -n -r |uniq >> $2/url2.txt
	a=0
	while read line
	do
	sleep 1
	code=$(curl -I "$line" 2>/dev/n
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值