今天在裝一個東西的時候,在網上看到了這樣的命令app
wget http://xxxx.sh -o - | sh 的用法get
不太明白-o -的用法因而乎man wget,看到了下面的一段話it
-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 -.)
io
意思就是-表明標準輸出,把文件的內容打印到標準輸出sed
因而上面的那個命令就能夠解釋爲:wget獲取一個文件,並把文件打印到標準輸出,sh把wget的標準輸出做爲本身的標準輸入執行.sh文件file