App-nrun

 view release on metacpan or  search on metacpan

misc/put_pubkey  view on Meta::CPAN

  
  expect {
    "yes/no"   { send "yes\r"   }
    "assword:" { send "$pass\r" }
  }
  
  send "echo S\"\"tArToFkEyUpDaTe\r"
  expect "StArToFkEyUpDaTe"
  
  send "test -d .ssh || mkdir .ssh\r"
  send "chmod 0600 .ssh\r"
  send "PUBK='$data'\r"
  send "test -f .ssh/authorized_keys && grep -v \"\$PUBK\" .ssh/authorized_keys >/tmp/authorizes_keys\r"
  send "echo \"\$PUBK\" >> tmp/authorized_keys\r"
  send "mv tmp/authorized_keys .ssh/authorized_keys\r"
  
  send "echo E\"\"nDoFkEyUpDaTe\r"
  expect "EnDoFkEyUpDaTe"
EOF



( run in 0.252 second using v1.01-cache-2.11-cpan-496ff517765 )