Previous: Pings
Up: Simple Zephyr Hacks and Customizations
Next: Colors and Locations
alias zr '~/.zrandom'
in your .cshrc.mine file which you would use to zwrite with random zsigs. The program follows:
#!/bin/csh -f
set zsigs = (\
"Your zsig number 1." \
"Your zsig can not easily deal with apostrophes and quotes." \
"Multi-line zsigs are not possible." \
"Exclamation points must be backlashed like this \!" \
)
set index = `jot -r 1 1 $#zsigs`
if ($index <1 || $index>$#zsigs) then
if ($index<0) then
@ index = - $index
endif
@ index = $index % $#zsigs
@ index = $index + 1
endif
zwrite -s "$zsigs[$index]" $argv:q
echo "$zsigs[$index]"
The perl randomizer was written by SIPB member Matthew Gray,
<mkgray>. In order to use it, you need to create a file of
your zsigs, which must be called ~/.zsigs, and then follow a
few steps. You would put the perl code into a file, calling it
something like .zrandom, make the file executable using
chmod 755 .zrandom, and then alias the execution of the file
with a line like
alias zr '~/.zrandom'
in your .cshrc.mine file. The code follows:
#!/afs/athena/contrib/perl/perl
srand;
open(ZSIGS, "/mit/$ENV{'USER'}/.zsigs")|| die("No ~/.zsigs file");
$ops = join(' ', @ARGV);
while(<ZSIGS>){
chop;
$sig[$i++]=$_;
}
$x = rand($i-1);
print("Zsig: $sig[$x]\n");
exec("zwrite", "-d", "-s", $sig[$x], split(' ',$ops));