scripting an interactive program session

Hello,

I'm looking to script the basic instant messaging program we have in my company, it's called "oi", it's working as follow:

# oi $user

then we have to launch it...
after finding the system of the user it's asking for the message...

then on a new line we have to hit ctrl+d

I want to script that with the message included in one system command but can't find a way to go around the interactive shell session.

help!

-david

If there's no method provided for automating it, you may need to brute-force it with a third-party tool like expect.

Have you tried a "here document"? To type control characters, first press CTRL-V then CTRL-D:

# oi $user <<EOF
message text
<CTRL-V><CTRL-D>
EOF