Load SSH key remotely
In modern systems, there's ssh-copy-id for this. But yeah it's not everywhere. In systems that don't have it, I have a similar script like yours, but to mimic the "standard", I call it ssh-copy-id.sh. Name it as you like, but I don't think "loadkey" really sums up the action of appending your public key to the authorized list file on a remote server. So I'd pick something better.

Cats are sure cute creatures, but you don't need one here:


cat ~/.ssh/id_rsa.pub | ssh -2 $host $installcat 



You can use input redirection:

ssh -2 $host $install &lt; ~/.ssh/id_rsa.pub


Lastly, the ssh ... echo hi stuff is repeated twice. It would be better to put it in a function. You can chain the different final echo + exit commands after the function with &amp;&amp; normally.