At 10:07 AM +0200 9/30/00, Axel Rose wrote: >On Sat, 30 Sep 2000 05:57:02 +0000 > Sveinbjorn Thordarson <paladeen@soth.zoneit.com> wrote: >> #!/usr/bin/perl >> >> use Shell.pm; >> >> write("$user"); >> >> #now what? How do I actually send the message and close? Is there >> another Unix command that just sends text in a single line command? > >Try learning Perl a bit. >"use Shell" rather than "use Shell.pm" >Read documentation (perldoc Shell). >"use Shell qw(write)" >lets you use the shell command "write" because otherwise "write" >is an internal Perl function. >I wouldn't use Unix write for a simple text line. You would need >to learn more about write which expects ctrl-d to end a message. > >Just execute "w", extract the tty column and do in Perl >system( "echo moin >/dev/pts/0") For Unix flavors that actually *have* a /dev/pts. Not all of them do. And, unless this script is running as root, users can block this type of message. This kind of thing is also pretty pointless in today's environment where users usually have several xterms up, so they may not even see the message even if it gets to the "terminal". Best just to send email. But if you really must do this, see if there's a "wall" command on your machine. On both Linux and Solaris, there are alternative ways to get the message to wall besides typing on standard input, and wall figures out who's on all by itself. I think it writes to all terminals that are being used, which makes it harder to miss the message. > >This is a MacPerl mailing list! > > >Regards > > >Axel Rose > ># ===== Want to unsubscribe from this list? ># ===== Send mail with body "unsubscribe" to macperl-request@macperl.org -- -- Paul Schinder schinder@pobox.com # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org