🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nn
Article #2067

Re: Deluxe Sigs in NN

#2067
From: Rob Lemley
Date: Wed, 04 Sep 1991 23:01
44 lines
2525 bytes
In <8968@cs.tulane.edu> rawdon@cs.tulane.edu (Michael Rawdon) writes:

>In <28BFD864.10903@ics.uci.edu> tittle@alexandre-dumas.ics.uci.edu (Cindy Tittle Moore) writes:

>[An exceprt from her script:]
>>@ quotenum = $quotenum % 20 + 1 # where 20 is the total # of files you have

>I'd like to see a randomizing function where you don't have to make some
>modification to the function whenever you add a new signature to the database.
>I.e., you just stick a new sig in and the program does everything else for
>you.  Having to go make modifications to other files seems (and actually
>is, IMHO) awkward.

I'm a little rusty on csh (don't know tcsh) but ...
Try replacing the above line with these two lines:

@ numquotes = `/bin/ls $quotedir | wc -l`
@ quotenum = $quotenum % $numquotes + 1

of course, if you get more than one hundred quotes the program has to
be changed.  You could get dozens of answers to this in comp.unix.shell
(but you might get flamed for writing scripts in csh :-).

How about a little sh for this on.  This script just plucks
a file at random from your quote directory, doesn't care
what the filenames are.  I've taken some extra info from date
to come up with a larger random number.

: setquote
# sh/ksh version
# assumes system V style date command w/formatting for SSMMHHdayofyear
newsdir=$HOME/News
quotedir=$HOME/News/quotes
quotenum=`/bin/date '+%S%M%H%j'`
numquotes=`/bin/ls $quotedir | wc -l`
quotenum=`awk "BEGIN { print $quotenum % $numquotes + 1; exit }"`
curquote=`/bin/ls $quotedir | sed -n -e "${quotenum} p" -e "${quotenum} q"`
cp $quotedir/$curquote $newsdir/.signature


Rob Lemley
---
    "Searchlight casting, for faults in the clouds of delusion"
                   (Onward through the fog!)
Technical Details
Message-ID: <1991Sep4.230119.884@b15.b15.ingr.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!gmdzi!unido!math.fu-berlin.de!ox.com!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!uunet!infonode!ingr!b15!rob
References: <1991Aug30.021038.1235@unlinfo.unl.edu> <dfs.683560439@reg> <28BE93E1.5658@ics.uci.edu> <8963@cs.tulane.edu> <28BFD864.10903@ics.uci.edu> <8968@cs.tulane.edu>

Show Full Headers
Complete Article Headers
Message-ID: <1991Sep4.230119.884@b15.b15.ingr.com>
Subject: Re: Deluxe Sigs in NN
Date: Wed, 04 Sep 1991 23:01:19 +0000
From: rob@b15.b15.ingr.com (Rob Lemley)
References: <1991Aug30.021038.1235@unlinfo.unl.edu> <dfs.683560439@reg> <28BE93E1.5658@ics.uci.edu> <8963@cs.tulane.edu> <28BFD864.10903@ics.uci.edu> <8968@cs.tulane.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.nn.mbox.zip!gmdzi!unido!math.fu-berlin.de!ox.com!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!uunet!infonode!ingr!b15!rob
Newsgroups: news.software.nn
Organization: Intergraph Huntsville
Lines: 44