Thread lesen/schreiben auf /dev/tty
(6 answers)
Opened by Gast at 2007-03-20 13:49
Hab nun einen Tag mit Expect gespielt :)
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 #!/usr/bin/perl -w use strict; use warnings; use Expect; # command and parameters to execute my $command = "sshfs"; my @params = ("user\@server:/home/user", "~/remote_home"); # data to be sent by expect my $password = "********"; # spawn a new command my $exp=new Expect(); $exp->debug(3); # 0,1,2,3 $exp->spawn($command, @params) || die "Error: Cannot spawn process. $!\n"; # wait for the password prompt $exp->expect(5,-re=>'assword:') or die "No password prompt\n"; #print("\nError: " . $exp->error() . "\n"); # send password $exp->send("$password\n"); $exp->soft_close(); exit(0); Leider funktioniert das nicht Debug Output Code: (dl
)
1 localuser@vigo:~/perl$ ./expect.pl <!--EDIT|davewood|1174489930--> |