On Thursday 17 August 2006 2:36 pm, Mick Semb Wever wrote:
> Works a charm! Straight off the bat too.
> Your answer went well belong the fish size I was hoping to catch.
> Thanks Duncan.

Here's my sigmonster, I have lots of files in a single dir (TIN style sigdir)

Yeah I know about as elegant as a Russian sledgehammer; but it works
and was the first script I ever wrote.

<Begin Script> 
#!/bin/bash

# this sets $b to the number of files in .sigs and randomly picks one

b=`ls ~/.sigs | wc -w`
RANGE=$b
number=$RANDOM
let "number %= $RANGE"

# this ensures that it won't pick sig000 which is invalid (of course if
#  have a sig000 then comment this out)

if [ $number = "0" ]
        then
        number=1
        else
        number=$number
fi

# this makes sure that it reads the right file,
#  ie: sig001 not sig1.

# When your .sigs get to the thousands
# Uncomment the following and
# replace the USEME=$number in the $d stanza
  m=1000
  c=100
  d=10
if [ $number -ge $m ]
        then
        USEME=$number
   else
   if [ $number -ge $c ]
        then
        USEME=0$number
   else
   if [ $number -ge $d ]
        then
        USEME=00$number
   else
        USEME=000$number
   fi
   fi
fi
# Here we define output,
#  this is for the screen.

 echo 
"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
 echo "                 Your random .sig is sig# $USEME                         
  \\"
 echo "                         Your .sig reads:                                
 \\"
 echo 
"==========================================================================="
     cat ~/.sigs/sig$USEME
 echo 
"==========================================================================="
 echo "                    Have a super-linuxy day!                             
 /"
 echo "                                                                         
/"
 echo 
"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="

# This puts the random sig in a file named .slrnsig in the News directory
# and moves the old sig into a file named .slrnsig.old in case you want to
# use it instead.
 cat ~/News/.slrnsig > ~/News/.slrnsig.old
 cat ~/.sigs/sig$USEME > ~/News/.slrnsig

<End Script>
-- 
"Remember there's a big difference between kneeling down 
and bending over."
        -- Frank Zappa


_______________________________________________
Pan-users mailing list
Pan-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/pan-users

Reply via email to