lazy prompt for ssh public key passphrase

Solution 1:

Here's what I used to solve this problem for ssh shells. I alias the ssh command to first check if the keys have been loaded and if not, load them first, then perform the ssh command:

alias ssh='[[ `ssh-add -l` == "The agent has no identities." ]] && ssh-add; ssh'

I put that in my .alias and source it from .bashrc