Use bash to interface with "write" command?
Hi,
I need to add some features to a bash script that will use the "write" command to a user. Write and wall make scripting difficult because you can't send message bodies as the commandline arguement. Is there any way to push text down writes throat using bash and then automate CTRL - C? (Probably an ansi code on the end of the message)? Anyone who has accomplished something similar can help. Thanks. |
you mean something like :
[root@tigerente ~]# echo "TEST^D" | write chakkerz write: chakkerz is logged in more than once; writing to pts/7 [root@tigerente ~]# and on pts/7: [chakkerz@tigerente ~]$ Message from root@tigerente.its.uq.edu.au on pts/6 at 16:09 ... TEST^D EOF ?? the CTRL+C you mention i assume you want to use to terminate the message, if that is correct, you really want to use CTRL+D which is an EOF character. To put that in your message you use CTRL+V then CTRL+D so that TEST^D is actually TEST^V^D hope that helps |
oh one thing to mention, that means that your server (the one running the program) will go back to the prompt. but that will happen if you don't have the ctrl+d in there...
|
That's it!
Yeah, the CTRL-D character is what I meant. Seems either is irrelevant though, as echo itself seems to be appropriate for sending EOF. Adding the control char in there just results in: Message from root@prole on pts/6 at 04:46 ... TEST^D EOF Echo does the job without the ^C or ^D Thanks so much, I tried write jkelley < file without success, this, however, seems even better. Thanks! |
All times are GMT -5. The time now is 06:29 AM. |