Paul Schinder wrote: > 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. I'm sorry I wasn't clearer in my first message. The "Use Shell.pm" was a stupid typing mistake on my behalf, as was the omission of qw(write), by the way. I'm not quite that new to Perl. However, I need to be able to send a different message to various users when they telnet into the Linux box at regular intervals. I was planning on using cron, and a perl script that uses who and write. wall won't work because it targets everyone. The message must be instantaneous and appear in the user's terminal. Is there anything that lets you send a text message to a user in a single line? How do I print into the write command and then end it with the Control-D? That's the real issue. Thanx, Sveinbjorn Thordarson # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org