Why don't you just use a shell script as a login shell for a new account
that you'd use only for such purposes? If you want to listen on a
particular port, you'll prolly need something more than a bash script.
Here's something simple that you might set as a login shell on a new
account....(warning: probably gonna be a hack, written in mailer):
#!/bin/bash
# msguser - tidy little interface to the write command
echo "Input a user to write to: "
read USER
echo "Input a message to send: "
read MESSAGE
islog=`w -h | grep -i $USER | awk '{ print $2 }'`
# we only want the first tty they're on.
islog=`echo $islog | awk '{ print $1 }'`
# tty menu would be nice here...
if [ $islog ]; then
echo $MESSAGE > ./.msg_
write $USER $islog < .msg_
rm .msg_;
elif [ !{$islog} ] ; then
echo "User isn't logged in.";
fi
# end script
############
Hrm, well...it looks like it should (possibly) work. Give it a try. A
good addition would be to have it present a menu of tty's that the user was
logged in on, allowing you to message more than the first one (default).
Don't have time for that atm though.. :)
--
Will Shaw
[EMAIL PROTECTED]
At 11:49 PM 6/20/98 -0700, you wrote:
>Hi,
>Looking for a way to setup a script so I can telnet into a certain port
>on my box, it would prompt for a username, I would type a user and press
>enter, then it would prompt for a message, i would type it and press
>enter. Then it would take that and maybe use the write command to write
>it to that user logged into this computer.. Any suggestions? Thanks!
>
> Bryan
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject.