Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Shell: Reads a passcode.
if [ $# -ne 2 ] ; then
echo "Usage: ssh-add-pass keyfile passfile"
exit 1
eval $(ssh-agent)
pass=$(cat $2)
expect << EOF
spawn ssh-add $1
expect "Enter passphrase"
send "$pass\r"
expect eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment