I am using Ubuntu 16.04.
I have written a basic bash file which automatically logs me into my SSH server. Is there a way to add a message which says "Connection failed" if SSH can't reach the server? Possibly an
if command? I have put the file on GitHub.
#!/bin/sh #I wrote this little bash script for people. #It's just for people that don't know how to make an auto login script for SSH. clear echo "Welcome, $USER !" echo "Connecting to SSH server..." sshpass -p "passwordhere" ssh -o StrictHostKeyChecking=no user@host