Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing Enter Key

Status
Not open for further replies.

nAtHaNs

Technical User
Feb 14, 2002
57
US
hi all,

i have to make a script that calls ontape command and will automate the mounting of tapes to the drive. My problem is how to simulate/execute the enter key just like pressing the enter key on the keyboard since the ontape command requires that the enter key be pressed in order continue.

Can someone help me with this!

thank you!
 
Mike,

If you mean that 'will it give the mksysb command the enter key it needed when it asks for it', well the answer is "no".

With simple scripts maybe that requires input it will work.

Yes, you're right I'm near to giving up on this but I really think there is a solution to this.

try the command:
find /directory -print| backup -i -f /dev/rfd0

it also asks for mounting the device and pressing the enter key
 
bigoldbulldog,

I don't want to ignore the use of enter key, just want to avoid the pressing of the key. So I want to give an equivalent signal just like pressing the enter key.
 
Not all programs can be controlled using STDIN redirection, some programs actively block this by taking input from /dev/tty, others (I think) block it by flushing STDIN before they ask a question of the user.

If mksysb or whatever is opening /dev/tty then I don't think there's anything you can do about it.

If it's using the flushing technique then you can probably get around the problem by using something like expect or by the Perl trick I described earlier.

In your place my first thought would be to investigate the tape changer you're using and see if it can be made to recognise the end-of-tape condition. I know you said that you checked this out already but it might be worth revisiting and maybe talking to the vendors technical support dept.

Failing that - you'll have to investigate the use of expect or Perl but you should remember that whether these will work will be dependant upon which program yuo're trying to control - so if you're going to be using ontape then your test should use ontape as well.

How would you like to proceed? Mike
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 

Guess I'll have to look at expect first..Is expect downloadable from the net? including the installation and configuration instructions..will it run on different unix platforms?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top