My company has begun to use the "scd-event" script in our deployment of
GnuPG to employee workstations.
I noticed after reviewing the example script that there are a number of
problems with its implementation. Some of the more glaring concerns include
- The --new-code option appears twice in the case statement.
- Option parsing requires = for option arguments, but this is not mentioned in the usage message.
- The usage message mentions the --old-code option twice.
I decided to rewrite this script so that option parsing would be more
robust. I also included a number of fixes for style problems.
To parse the options, I chose to use the GNU getopt utility. This tool
allows for long options (thus, we can't use getopts). It also allows for
options that are separated by a space or by an = character from their
Since I spent the time to make these improvements, I thought I might as well
submit the changes upstream so that others might benefit.