Re: [Evolution] Script-generated sigs



On Mon, 2003-01-06 at 16:15, David McNab wrote:

Note that Evolution needs '<br>' tags for line breaks.

And as soon as I sent my message, David's messages showed up with the
answer to my problem.  I changed my sig generator to include the <br>
tags and now I get what I want.  Thanks David.

Since posted a python script, I'll go ahead and post my bash scripts. 
It's actually 4 pieces: a sig template that has the static lines and a
tag that gets replaced with the random line, a 'gettag' script to select
the random line, a file of one-liners that 'gettag' uses for input, and
a top level script that does the replacing in the template:

signature.template 
==============================8<----------------------------------
Dwight N. Tovey<br>
Email: dwight dtovey net<br>
http://www.dtovey.net/dwight<br>
---<br>
$f
==============================8<----------------------------------

gettag
==============================8<----------------------------------
#! /bin/bash

TAGFILE=${HOME}/.sigtags
DEFTAG="This signature line for rent"

if [[ ! -f ${TAGFILE} ]]; then
  print ${DEFTAG}
  exit 0
fi

MAXTAG=$(wc -l ${TAGFILE} | awk '{print $1}')

((TAGLINE = RANDOM % MAXTAG + 1))

awk -vTAGLINE=${TAGLINE} 'NR==TAGLINE {print}' ${TAGFILE} 
==============================8<----------------------------------

siggen
==============================8<----------------------------------
#!/bin/bash

tagline="$(${HOME}/bin/gettag.bash)"

if [[ -f ${HOME}/.signature.template ]]; then
    cat ${HOME}/.signature.template | sed -e "s/\$f/${tagline}/" 2>
/dev/null
elif [[ -f ${HOME}/.signature ]]; then
    cat ${HOME}/.signature
else
    cat <<EOF
Dwight N. Tovey
EOF
fi
==============================8<----------------------------------


I'll let you come up with your own '.sigtags' file.

        /dwight
-- 
Dwight N. Tovey
Email: dwight dtovey net
http://www.dtovey.net/dwight
---
How come everyone's going so slow if it's called rush hour?





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]