Surprising command line options handling

Doug Barton dougb at
Tue Feb 24 00:19:55 CET 2015

On 2/23/15 2:51 PM, Daniele Nicolodi wrote:
> Hello,
> I've been struggling quite a long while today trying to understand why
> the following command does not do what I expected:
> gpg --export-secret-subkeys 41E999D7! \
>      --export-options export-reset-subkey-passwd
> It does not reset the password on the exported subkey.
> After some head scratching I recognized that gpg stop parsing arguments
> when it encounters the key id and ignores what follows.

That's not 100% accurate, but I won't quibble. :)

The man page makes it very clear that the format is as follows:

gpg2 [--homedir dir] [--options file] [options] command [args]

options come before commands, and anything after the command is 
interpreted as an argument to the command.

hope this helps,


More information about the Gnupg-users mailing list