点击(此处)折叠或打开
-
#!/bin/bash
-
page=1
-
-
function get_html(){
-
-
curl -A "Mozilla/4.0 ??compatible?? MSIE 6.0?? Windows NT 5.0?©" http://www.qiushibaike.com/8hr/page/$page>fun
-
-
echo "This is page$1"
-
-
sed -n '//,/<\/div>/p' fun|sed 's/^<.*//g' |sed '/^ *$/d'>f
- read_by_line
- let page=$1+1
- have_fun $page
- }
- function have_fun()
- {
- for i in `seq 10`
- do
- Input_user=n
- i=$page
- Input_user=0
- if [ $i -eq 1 ]
- then
- echo "have fun"
- get_html $i
- else
- echo "Continue? [y|N]"
- read Input_user
- fi
- if [[ $Input_user == N ]]
- then
- exit
- else
- get_html $i
- fi
- done
- }
- function read_by_line()
- {
- clear
- while read line
- do
- echo
- echo $line |sed 's/
/\n/g'
- echo
- echo "Continue [y|N]"
- read Input_user</dev/tty
- if [[ $Input_user == N ]]
- then
- exit
- fi
- done <f
- }
- have_fun
- rm -rf f fun
- read_by_line