[alt.sources] shell script to generate save names in rn

gmp@rayssd.UUCP (08/13/87)

Most of the time I'm too lazy to come up with a meaningful name for a
news article that I'd like to save while using rn.  If I pick a name
that's easy to type, I tend to ignore the file later when I'm looking
for interesting saved articles.  With the line given below added to
your $RNINIT file, along with the shell script that follows, you can
avoid this horrid dilemma by having cryptic (but intriguing!) names
generated for you automatically.  I've been using this method myself
for about two months now, and am reasonably satisfied with it.

To use, add this line to the file pointed to by your RNINIT environment
variable.  (Don't forget to change PATHNAME to the full pathname of the
shell script "savename".)

-ESAVENAME=%`'PATHNAME/savename \'%s\' '`

Next, put the following Bourne or Korn shell script in the file
PATHNAME/savename.

#! /bin/sh
#  produce shorter strings from subject lines
PATH=/bin
(
    wordlist=`echo $* | sed -e 's/[^a-zA-Z0-9]/ /g'`
    for word in $wordlist
    do case $word in
       ?|??|???) ;;
       *) nword=`echo $word | sed -e 's/[aeiou]//g' -e 's/\(.\)\1/\1/g'`
          case "$nword" in
          ?|??) echo -n "${word}_" ;;
          *)    echo -n "${nword}_" ;;
          esac
          ;;
       esac
    done
    echo
) | sed -e '
    s/^_*//
    s/_*$//
'
exit
# end of script

Finally, to save an article, just type s and <carriage-return>.  After
a "slight" pause, a message about where the file has been saved will be
produced by rn.  By the way, this has only been tested on a BSD VAX.  I
suppose that things might work a little differently on System V, but
that is left as an exercise, etc.  It does tend to produce long file
names, so that's one thing to watch out for.  If you have fixes and or
suggestions for this shell script, don't hesitate to let me know.

-- 
Greg Paris                                          gmp@rayssd.ray.com
                {cbosgd,gatech,ihnp4,mirror,necntc,uiucdcs}!rayssd!gmp
                                            I'm not a burning building