[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Pan-users] My Wish List
From: |
Toby Inkster |
Subject: |
Re: [Pan-users] My Wish List |
Date: |
Sat, 20 Jul 2002 01:07:15 +0100 |
On Fri, 19 Jul 2002 18:32:00 -0500
Jeff Vian <address@hidden> wrote:
| Why not post the code for something of this sort (so we all do not have
| to hunt for it, or repeat the development of such a trivial item.
| Then it should be easy to implement for almost anybody.
OK, here's how to do it.
Firstly, we create a named pipe called, for example .dynamic_signature. To do
this we run this command:
address@hidden ~]$ mkfifo .dynamic_signature
Now, we create a program that repeatedly writes a signature to
.dynamic_signature. Here is a nice Perl script that does just that.
---------------------------------------------------------------
#!/usr/bin/perl
while (1 == 1) {
($s,$d) = split(/load/, `uptime`);
($d,$s) = split(/up/, $s);
chop($s); chop($s); chop($s);
$s =~ s/^\s//;
$s =~ s/\s+/ /g;
($a, $b, $c) = split(/\, /, $s);
$s = "$a, $b";
if ($s =~ m/user/) {
($s, $a) = split(/\,/, $s);
}
$r = `uname -rs`;
chomp($r);
$UPTIME = $s;
$OPERATINGSYSTEM = $r;
$FORTUNE = `/usr/games/fortune -s`;
$MAINSIG = "Luser Dude\nSome Company\nSomewhereville";
open (FILE, ">/home/luser/.dynamic_signature");
print FILE "$MAINSIG\n\n$FORTUNE";
close (FILE);
}
---------------------------------------------------------------
Now, run "cat .dynamic_signature". You'll notice that cat seems to hang. In
another terminal, run the Perl script above. You'll notice that the cat command
springs to life. Yay!
This seems to work very well. :-)
--
Toby A Inkster. I can't think of anything clever to write here.
E-mail: tobyink.co.uk
PGP: http://www.goddamn.co.uk/tobyink/node.cgi?id=12
Web Page: http://www.goddamn.co.uk/tobyink/
IM: AIM:inka80 ICQ:6622880 YIM:tobyink Jabber:tobyink-message.de
Good girls go to heaven, bad girls go everywhere.
signature.txt
Description: For security, this message has been digitally signed.
- [Pan-users] My Wish List, Toby Inkster, 2002/07/18
- Re: [Pan-users] My Wish List, laurent . duperval, 2002/07/18
- Re: [Pan-users] My Wish List, gaw zay, 2002/07/18
- Re: [Pan-users] My Wish List, Toby Inkster, 2002/07/18
- Re: [Pan-users] My Wish List, Carl Wilhelm Soderstrom, 2002/07/18
- Re: [Pan-users] My Wish List, Carl Wilhelm Soderstrom, 2002/07/18
- Re: [Pan-users] My Wish List, Jeff Vian, 2002/07/19
- Re: [Pan-users] My Wish List,
Toby Inkster <=
- Re: [Pan-users] My Wish List, gaw zay, 2002/07/19
- Re: [Pan-users] My Wish List, Toby Inkster, 2002/07/19
- Re: [Pan-users] My Wish List, Jeff Vian, 2002/07/19
- Re: [Pan-users] My Wish List, Carl Wilhelm Soderstrom, 2002/07/22