LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-08-2017, 04:25 PM   #1
genogebot
Member
 
Registered: Jun 2010
Location: Brisbane, Australia
Distribution: Xubuntu 16.04.1 / Linux Mint 18 XFCE / Linux Mint 18 Mate / Ubuntu Server 16.04.1 / Lubuntu 16.04.1
Posts: 146

Rep: Reputation: 20
Question gpg2: documented '--output' option is not accepted


I'm using gpg2 in Xubuntu 16.04:
Code:
gpg2 --version
gpg (GnuPG) 2.1.11
libgcrypt 1.6.5
The man page for gpg2 and the online manual (http://manpages.ubuntu.com/manpages/...n1/gpg2.1.html) as well as the command 'gpg2 --help' all clearly indicate that the option '--output' can be used to export a key to a specified file:
Code:
--export-secret-keys

--export-secret-subkeys
      Same as --export, but exports the secret keys instead.
      The exported keys are written to STDOUT or to the file given with option --output.
When I do so in a terminal, however:
Code:
gpg2 --export-secret-keys somewhere@gmail.com --output somewhere.secret.gpg
I get a message
Code:
gpg: Note: '--output' is not considered an option
and the output is sent to STDOUT. I can, of course, redirect STDOUT to a file, but I don't understand why the '--output' option isn't available when every document I can find says it should be.
 
Old 02-08-2017, 05:16 PM   #2
genogebot
Member
 
Registered: Jun 2010
Location: Brisbane, Australia
Distribution: Xubuntu 16.04.1 / Linux Mint 18 XFCE / Linux Mint 18 Mate / Ubuntu Server 16.04.1 / Lubuntu 16.04.1
Posts: 146

Original Poster
Rep: Reputation: 20
RTFM

I stumbled over the solution to this one myself.

I assumed that the gpg2 commandline parsing would be intelligent enough to process gpg-specific 'options' and 'commands' in any order, but it seems that is not the case.

In the general introductory blurb of the gpg2 man page, I found:
Code:
Please remember that option as well as command parsing stops as soon as a non-option is encountered
'--output' is an option, and '--export-secret-keys' is a command, so the correct terminal command should have been:
Code:
gpg2 --output somewhere.secret.gpg --export-secret-keys somewhere@gmail.com
Doh!

In my defence, though, the error message was misleading in suggesting that '--output' is not an option - it would have been more accurate to report that options are not processed after commands.

Last edited by genogebot; 02-08-2017 at 05:19 PM.
 
Old 02-08-2017, 05:27 PM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
find is particular "that way" also.

Good job and well done.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gpg/gpg2 encrypted for multiple recipients BUT only one key accepted for decryption? jtwdyp Linux - General 0 07-24-2015 01:44 AM
redhat 6 gpg2 none gui encryption Xris718 Linux - Security 2 06-15-2012 10:56 AM
Password(s) accepted for login but not accepted for applications. JZL240I-U Ubuntu 29 02-14-2012 11:53 AM
Standard script output to screen & -x option output to file BoBeau236 Programming 6 05-10-2011 07:43 AM
Where is dvdauthor -T option documented pwalden Linux - Software 2 06-17-2005 03:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration