Sam Trenholme's webpage
This article was posted to the Usenet group alt.hackers in 1995; any technical information is probably outdated.

Auto pgp-sign news

Article: 7542 of alt.hackers
From: (Ayman M. El-Khashab)
Newsgroups: alt.hackers
Subject: Auto pgp-sign news
Date: 26 Mar 1995 15:59:14 GMT
Organization: The University of Texas at Austin, Austin, Texas
Lines: 85
Approved: me!
Message-ID: 3l430i$
X-Newsreader: TIN [version 1.2 PL2]
Status: RO


I also have a script that will automatically sign news using
your pgp signature feature. You can either set the PGPPASS
environment variable or it will prompt you for the pass phrase,
I use it with tin, but it *SHOULD* work with other readers but
I haven't tried it.

By default, tin starts the vi editor with the command line
vi +%N %F. This starts vi at line N of file F. This script
can just replace the name of the editor. for instance, if you
name the script auto_pgp, your command line would look like this

auto_pgp +%N %F

If you are not using the open at line x feature, you will either
have to edit the script or just make the command line

auto_pgp +1 %F. Now it will always start at the first line.

The nice thing about this is that you get the full vi editor with
the header and everything exactly as it would appear. The script
then takes your article and splits the header and message into
two different files. Then it signs the message file and rebuilds
the article, then it returns to the news reader and you can post
or do whatever options the newsreader has.

It isn't as good as the other one that was posted here, because
you can't re-edit an article. Next version I'll try that.

So here it is:


# Auto signer that works with tin
# Ayman M. Elkhashab
# Send requests/ bugs to

# start the editor to edit the post
vi $1 $2

# Separate the header and the message
header=0 # variable set at end of header
cat $2 | # pipe file through filter
while read line
if [ $header -eq 0 ]; then #outputs header & message to dif files
echo $line | sed 's/:$/: /' >> header.$$ #fixes lines ending in colons
if [ -z "$line" ]; then header=1 #sets header end and write rest
to another
fi #file with the message
else echo $line >> message.$$

# Begin the PGP portion of the script. Sign the message.
pgp -sta message.$$

# Rebuild the Post
cat header.$$ message.$$.asc > $2

# Remove all of the Temporary files
rm header.$$
rm message.$$
rm message.$$.asc

# Exit the script

- --
For the Public Key, finger or WWW at
Why is it always easier to volunteer than to unvolunteer?
- -------------------------------------------------------------

Version: 2.6.2


Back to index