Simulate ENTER key in ksh scripting

Using SCO 5, Ksh here
I am trying to automate some process that i am doing manually.
During some point of time, I will have to press enter to clear away some messages.

This is how I do manually.

*one command*

r

r

r

r

r

I enter the command once, then press enter key 1 more time to preempt the message and clear then away. The r to repeat the command and enter key again to clear away the message.

How do I simulate the user pressing the ENTER key in the script???

this looks like a job for Expect - Expect - Home Page

If you do not have expect - search the forums for 'here document' Blank lines in a here document are the same as pressing <return>

The yes command exists pretty much to solve this problem.

well, seems that the Here-document works for me
I'm not a guru with scripts but hey, it works for me. :slight_smile:

#!/bin/bash

until [ ]
do

sh << loopforever

*one command*




<< loopforever
done

With lots of lines to clear any messages that pop out.
Also, it will run throughout the night and I will stop it manually.

it seems to be only to output string repeatedly...
How can i use it?

wait a min .... that does not clear the message !!!
back to the drawing board .... :mad: