# Script to get SSH connection
# This script is free, licensed as GPL v. 3
#
# Visit us: http://pajeonline.blogspot.com
#
# Parameters:
#
# 1- Machine name or IP (must have)
# 2- Port number (optional)
# 3- User (optional)
#
user=$USER
port="22"
if [ "$#" == "0" ]
then
echo "No machine name or IP informed!! Aborting."
exit 1
fi
# Port informed.
if [ -n "$2" ]
then
port="$2"
fi
# User informed
if [ -n "$3" ]
then
user="$3"
fi
echo "Trying to connect to $1, on port $port as $user..."
echo
ssh -p $port $user@$1