我看到一些 linux 页面说如何安装密钥:
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
Run Code Online (Sandbox Code Playgroud)
wget 中的“-O -”是什么?
它似乎与“添加 -”有关。
这些是如何运作的?
谢谢~
小智 5
我用**来表示它很重要。从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 -.) **
Use of -O is not intended to mean simply "use the name file instead
of the one in the URL;" rather, it is analogous to shell
redirection: wget -O file http://foo is intended to work like wget
-O - http://foo > file; file will be truncated immediately, and all
downloaded content will be written there.
Run Code Online (Sandbox Code Playgroud)
并从 man apt-key
add filename
Add a new key to the list of trusted keys. The key is read from
filename, or ** standard input if filename is -.**
Run Code Online (Sandbox Code Playgroud)
这解释了您的命令。