赞
踩
在云计算蓬勃发展的今天,与其在家闲着,不如立即开始学习,下面千锋给大家讲解一下:shell脚本实现获取图片。
#!/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=KaTeX parse error: Expected 'EOF', got '&' at position 61: …x?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= ( c u r
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。