#!/usr/bin/perl -w

use strict;
use warnings;
use Expect;
use IO::Tty;
use IO::Pty;

my $scp = 'scp  -P 5555 -r -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ';
my $location = '/home/pforty/work/gentoo-install root@localhost:/tmp';
my $command = $scp.$location;
my @parameters = ();

my $exp = new Expect;
$exp->raw_pty(1);
#$exp->slave->stty(qw(raw -echo));
$exp->spawn($command, @parameters)
  or die "Cannot spawn $command: $!\n";

#sleep 3;            # give it time to prepare grub
#$exp->send("\n");   # send some string there:
#sleep 3;            # give it time to prepare grub
#$exp->send("\n");   # send some string there:

$exp->expect(20, ['Password:']);
$exp->send("inttest\n");
sleep 1;
#$exp->soft_close();

print "Done\n";
