You may want to try something more along the lines of this:
Quote:
#!/bin/bash
TEST=`ssh -i key1 user@$1`
if [ ! TEST ]; then
ssh -i key2 user@$1
fi
|
I am just coming up with this out of my head, and no testing is involved at all.
Something you may also want to think about, since it appears that what you are trying to do is authenticate using two different keys, so that if the location you are going to doesn't have the first key it tries the second key, is to simply import the first key into the location that doesn't have it.