shell起動時にkey登録

# ~/.zshrc
test $(ssh-add -l | grep "/Users/toqoz/.ssh/id_rsa" | wc -l) = 0 && ssh-add

みたいな感じ。もっと登録すべきkeyがある場合は、追加していくと良いと思う。

ssh-add -l は一個も登録されてない時、The agent has no identities. っていうのを標準エラーではなく標準出力に出すから、 test $(ssh-add -l | wc -l) = 0 とかってやってもうまくいかない。