wget一个小技巧

今天在装一个东西的时候,在网上看到了这样的命令

wget  http://xxxx.sh -o -  | sh  的用法

不太明白-o -的用法于是乎man wget,看到了下面的一段话

-O file
       --output-document=file
           The documents will not be written to the appropriate files, but all
           will be concatenated together and written to file.  If - is used as
           file, documents will be printed to standard output, disabling link
           conversion.  (Use ./- to print to a file literally named -.)

意思就是-代表标准输出,把文件的内容打印到标准输出

于是上面的那个命令就可以解释为:wget获取一个文件,并把文件打印到标准输出,sh把wget的标准输出作为自己的标准输入执行.sh文件

 

posted on 2016-03-01 20:43  追寻前人的脚步  阅读(246)  评论(0编辑  收藏  举报

导航