scripting an interactive program session

Tags
shell scripts

 
Thread Tools Search this Thread
# 1  
Old 02-24-2012
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
# 2  
Old 02-24-2012
If there's no method provided for automating it, you may need to brute-force it with a third-party tool like expect.
# 3  
Old 02-27-2012
Have you tried a "here document"? To type control characters, first press CTRL-V then CTRL-D:

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


|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Bash Scripting program rami-ali Homework & Coursework Questions 2 11-21-2018 11:57 AM
Passing arguments to interactive program through bash script, here document biochemist Shell Programming and Scripting 13 07-17-2014 04:53 PM
Help Scripting: Sync Photos Program abudis Shell Programming and Scripting 1 07-01-2013 02:56 AM
Non-interactive login using C program in UNIX(Solaris) munish259272 Programming 1 01-20-2013 01:28 PM
Unix scripting and screen session dustytina Shell Programming and Scripting 6 06-20-2012 12:21 PM
Run interactive program in background and grep it doonan_79 Programming 1 06-20-2012 11:13 AM
Expect command use for interactive mode of scripting Dhruvak Shell Programming and Scripting 6 11-23-2011 06:46 AM
Non-interactive FTP within SSH session not working Subu1987 Shell Programming and Scripting 2 07-15-2011 04:14 PM
How to write script that behaves both in interactive and non interactive mode rits Homework & Coursework Questions 8 08-18-2009 12:47 AM
Develop Program with 'None Interactive Flag' warlock129 Shell Programming and Scripting 1 05-07-2009 11:30 AM
Shell scripting Program balaji23_d Shell Programming and Scripting 1 10-06-2008 01:31 PM
Shell scripting Program balaji23_d Shell Programming and Scripting 1 10-06-2008 09:45 AM
scripting an ssh session? jjinno Shell Programming and Scripting 2 08-28-2007 02:25 PM
Running an Interactive Program Remotely Terrible Shell Programming and Scripting 3 10-20-2006 12:48 AM
Making Interactive program sivasenthil_k Shell Programming and Scripting 4 07-23-2006 02:51 AM