I remember last year when I was looking for a job interview, I heard a classmate say that he likes Linux very much, I believe what he said is true, I think the people who like Linux are very happy from the shell script, because it can integrate the various resources on Linux to do great things. Here's a picture crawler that you can share with the next shell script.
How to use:
Copy the following code, named Img_downloader.sh. When used, enter under the shell./img_downloader.sh www.baidu.com-d Images, the shell script will put the picture down on the homepage of Baidu.
Copy Code code as follows:
#!/bin/bash
If [$#-ne 3];
Then
echo "Usage: $ url-d DIRECTORY"
Exit-1
Fi
For i in {1..4}
Todo
Case is in
-d) shift; directory=$1; shift;;
*) Url=${url:-$1};shift;
Esac
Done
Mkdir-p $directory
baseurl=$ (echo $url | egrep-o "https?:/ /[a-z.] +")
echo "$baseurl"
Curl-s $url | Egrep-o "]*>" |
Sed ' s//tmp/$$.list
Sed-i "s|^/| $baseurl/|"/tmp/$$.list
CD $directory;
While read filename
Todo
Curl-s-O "$filename"--silent
Done </tmp/$$.list