Skip to content

Instantly share code, notes, and snippets.

@mkouhei
Created August 27, 2017 22:09
Show Gist options
  • Save mkouhei/96d421784496de748238737023dee6c4 to your computer and use it in GitHub Desktop.
Save mkouhei/96d421784496de748238737023dee6c4 to your computer and use it in GitHub Desktop.
#!/bin/bash -e
read -p 'Enter passphrase:' -s pass
for i in id_rsa
do
expect << EOF
spawn ssh-add $HOME/.ssh/${i}
expect "Enter passphrase for $HOME/.ssh/${i}:"
send "$pass\r"
expect eof
EOF
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment