Improved ssh-agent check

The old test does not work if an ssh-agent is running but has no identities loaded. This works and is much cleaner.