Re: Getting rid of "Press Enter..." under Linux

new topic     » goto parent     » topic index » view thread      » older message » newer message

If the Eu program running under Linux adheres to the following
pre-requisites:

   It does not prompt the user for *any* input

   It does not include the string "Press Enter..." in *any* output

then you can use an "expect" script to run the program.  The expect script
will run the Eu program and when the program prompts with "Press Enter..."
it will automagically send a return character which will then cause the
program to finish.

Example time!

Here is a Eu Linux program called "hello.exu":

-- hello world prog under linux
include file.e
printf(1, "Hello Andy", {})
abort(0)

Here is an expect script called "runhello":

#!/usr/bin/expect
spawn exu hello
expect {
  "\n\nPress Enter...\r\n" {
    send "\r"
  }
  eof {
    exit 0
  }
}
expect eof
exit 0

Make the runhello script executable:

chmod u+x runhello

Now run it:

./runhello

No interaction needed!  You can even do:

./runhello >/tmp/hello.out
more /tmp/hello.out

Ok this is what one of my friends would call a "monster hack" but like a lot
of hacks it works smile

What would be better IMHO is a command line switch like:

exu -s hello

when -s would mean "suppress the Press Enter prompt at the end of
execution".

Regards,

Andy Cranston.

-----Original Message-----
From: Jamey [mailto:cribbsjg at EARTHLINK.NET]
Sent: 16 August 2000 13:15
To: EUPHORIA at LISTSERV.MUOHIO.EDU
Subject: Getting rid of "Press Enter..." under Linux


Sorry if this gets posted twice, but I thought I posted this yesterday but
it never showed up!

Does anyone know how to get rid of the "Press Enter..." prompt when a
program finishes running under Linux?

I thought I remember reading the answer somewhere, but a search of the docs
and the message archives did not turn anything up.

Thanks for the help!

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu