summaryrefslogtreecommitdiffstats
path: root/bin/laptop/ssh-add-helper
blob: cae6f2735545491e6810cb04692dde28b911493d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env perl
use strict;
use warnings;
use IO::Pty::Easy;

my $hostname = `hostname`;
my $pass = `pass search ssh.$hostname`;
my $pty = IO::Pty::Easy->new;
$pty->spawn("ssh-add -t 1800 $ARGV[0]");
$pty->read;
$pty->write($pass . "\n");
while (1) {
    last if $pty->read =~ 'Identity added';
}