这脚本哪错了
Tofloor
poster avatar
kikyoulzg
deepin
2016-01-01 09:00
Author
这是一个查看最新内核的小脚本
#! bin/bash
wget http://kernel.org/
n_line=0;
grep -A 1 stable index.html | while read LINE
do
    n_line=$ ((n_line+1))
    if [ $n_line = "2" ]
    then
        
        LINE=${LINE#<*>}
        LINE=${LINE#<*>}
        LINE=${LINE%<*>}   
                LINE=${LINE%<*>}
        echo "linuxzuixingneihe"
            echo $LINE
    fi
done

exit 0

,可是运行后只是下载了网页,why?

Reply Favorite View the author
All Replies
Bluek404
deepin
2016-01-01 09:34
#1
让我来一条常暴力的命令

  1. curl -s https://www.kernel.org | grep -o '[0-9]\.[0-9]\.[0-9]' | head -1
Copy the Code
Reply View the author
laoguang
deepin
2016-01-01 15:49
#2
你wget的就是网页,没文件啊!
wget http://kernel.org/
你这条命令意思就是下载http://kernel.org/,你应该是要下载一个文件,比如http://kernel.org/xxxxx.deb
Reply View the author
kikyoulzg
deepin
2016-01-01 17:18
#3
https://bbs.deepin.org/post/35059
让我来一条常暴力的命令

厉害厉害厉害厉害厉害厉害
Reply View the author
kikyoulzg
deepin
2016-01-01 17:19
#4
https://bbs.deepin.org/post/35059
你wget的就是网页,没文件啊!
wget http://kernel.org/
你这条命令意思就是下载http://kernel.org/,你应 ...

#! bin/bash
wget http://kernel.org/
这个是下载网页.
Reply View the author
ghostry
deepin
2016-01-01 17:58
#5
https://bbs.deepin.org/post/35059
让我来一条常暴力的命令

灰常好

Reply View the author
laoguang
deepin
2016-01-01 18:02
#6
本帖最后由 laoguang 于 2016-1-1 10:04 编辑
https://bbs.deepin.org/post/35059
#! bin/bash
wget http://kernel.org/
这个是下载网页.
卧槽,看错了。
Reply View the author
jiangbinaisj
deepin
2016-04-25 04:41
#7
wget https://kernel.org/ -O - | sed -n -r 'N;N;N;N;/stable:/p;' | grep -o 'https.*xz"'  | grep -o 'https.*xz' | sed 's/^/wget /' | sh
Reply View the author
jiangbinaisj
deepin
2016-04-25 04:41
#8
https://bbs.deepin.org/post/35059
wget https://kernel.org/ -O - | sed -n -r 'N;N;N;N;/stable:/p;' | grep -o 'https.*xz"'  | grep -o 'h ...

不是很好,但是能用
Reply View the author