On Thu, Jul 22, 2010 at 03:38, Sooraj S <soorajspadmanab...@gmail.com> wrote:
> Thanks for your help...It worked...My shell script prints properly...
>
> At one stage it will prompt for user input
> ------------------------------------------
> Mountpoint : Xpr23filesystem
> Kernel : verified
> P2P : katren"
> OK to go : [y/n] ?
> --------------------------------------
>
> How to get the user input...? (shell sctipt is called in my main code
> as shown in my first mail)
snip

If you need to interact with the shell or with programs you can use
the cmd method.  You will need to use lower level methods that let you
watch for content:

# type the command and hit enter
$t->print("$my_loc/my_shell.csh");
# wait for the program to reach the [y/n] prompt
$t->waitfor('^OK to go : \[y/n] \?');
# do this if you want it to be interactive
#my $choice = <STDIN>;
#$t->print($choice);
# or you can just send the same choice every time
$t->print("y");

You will need to use the put method instead of the print method if the
program does not require you to hit enter after typing y or n.


-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to