#!/usr/bin/env sh

userAtAddress="$1"
USER=$(echo "$userAtAddress" | cut -d"@" -f1);
HOST=$(echo "$userAtAddress" | cut -d"@" -f2);

if [ "$USER" = "$HOST" ]
then
  printf "Enter your username: "
  read -r USER
  USER=$(echo "${USER}" | tr -d '[:space:]')
  ssh "$USER"@"$HOST"
else
  ssh "$userAtAddress"
fi