Sample Resources List
such as Url.txt:
Copy Code code as follows:
Http://su.bdimg.com/static/superplus/img/logo_white_ee663702.png
Http://su.bdimg.com/static/superplus/img/logo_white_ee663703.png
Http://su.bdimg.com/static/superplus/img/logo_white_ee663701.png
Http://su.bdimg.com/static/superplus/img/logo_white_ee663704.png
Http://su.bdimg.com/static/superplus/img/logo_white_ee663705.png
Http://su.bdimg.com/static/superplus/img/logo_white_ee663706.png
We need to download these pictures and save them in our respective folders.
The script is as follows
such as download.sh
Copy Code code as follows:
#!/bin/bash
# Desc:download Resource
# Author: Ten years later, Lou's brother
Mydir= ' pwd '
While Read line
Todo
{
If [-N "$line"]
Then
CD $mydir
Url=$ (echo "$line" | tr-d ' \ r ')
picdir=$ (echo $url | sed-r ' s/http:\/\///g ')
Picname=$ (Echo ${picdir##*/})
Picpath=$ (Echo ${picdir%/*})
Mkdir-p $picpath
CD $picpath
Wget-o $picname ' echo $url '
Fi
}
Done < $
Exit 0
Here are a few points to note:
1. In order to remove line breaks at the end of a text file, delete:
Copy Code code as follows:
2, take the resource name:
Copy Code code as follows:
3, take the resource path:
Copy Code code as follows:
Run
Copy Code code as follows: