non-interactive scripting

Darryl Moore darryl-90a536wCiRb3fQ9qLvQP4Q at public.gmane.org
Mon Sep 28 21:36:13 UTC 2009


Hey all,

I did some googling to find out how to write non-interactive script for
creating GPG keys. I found it and now I have the following in my script


cat <<-EOF | gpg --batch --quick-random --no-tty --gen-key
%echo Generating a standard key
Key-Type: DSA
Key-Length: 1024
Subkey-Type: ELG-E
Subkey-Length: 1024
Name-Real: rsync.net
Name-Comment: $COMPANY
Name-Email: $CONTACT_EMAIL
Expire-Date: 0
Passphrase: $PASSPHRASE
# Do a commit here, so that we can later print "done" :-)
%commit
%echo done
EOF



This all works, but there are a few things I can't figure out (and Mr.
Google doesn't seem to be much help either. ).
1) what is with the minus sign between the double-less-than signs and
the EOF? The code I found had it in, I'd expect it not to work with it
there, but it does. Does it do anything?

2) what exactly do the percent signs mean in the body of the data being
piped? Are they simply commands to GPG or do they have some special
meaning in the context of the stdin redirection?

3) Why cannot I not accomplish the same thing by not using --batch and
simply piping the answers to prompted questions in the same manor as
above? I've tried. It doesn't work. I still get the prompts as if there
never was any stdin redirect.

I'd be very grateful to anyone who could enlighten me.

cheers,
darryl
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list