Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I see some linux page says how to install the key:

  wget http://packages.ros.org/ros.key -O - | sudo apt-key add -

What is "-O -" in wget?

It seems related with "add -".

How these works?

Thank you~

share|improve this question
    
- in wget is stdout (standard output), - in apt is stdin (standard input) –  nickanor Jan 10 '13 at 7:46
add comment

2 Answers 2

up vote 1 down vote accepted

The option -O - prints the downloaded file to standard output (instead of a ordinary file) and the - option in apt-key reads from standard input. The command is equivalent to the two commands:

wget http://packages.ros.org/ros.key
sudo apt-key add ros.key

When you chain both commands you don't have to bother with saving a file and usually the command is shorter.

share|improve this answer
add comment

I used ** to indicate it is important. from 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.

and from 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 -.**

this explains your command.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.