Getting cntrl-c entered inside a ksh script

hi guys,

my ksh script is calling another script. The other script expects user to press CNTR-C, and does not return to the prompt.

in my script, I want to call the other script, but somehow don't want it to wait forever, I want to return to my script.

e.g.

script2.ksh outputs:

"No name found; please enter a name"
Please enter a name if you want to continue

and it does not return until we either enter a name or press control-c.

but in script1.ksh, I want to run script2.ksh, and do a grep to see if it displays "No name found", and then continue. But because script2 does not exit until you enter a name and press return or control-c, I cannot do anything!

thanks

You could background it, wait a few seconds, and send it SIGINT with the kill command, terminating it like a ctrl-c. Or you could redirect a newline into its standard input, if a blank name will do. Or you could redirect /dev/null into its standard input, which will cause the read to instantly EOF instead of waiting, if the script can handle a failed read properly.

wonderful - thanks