You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
326 B

#!/usr/bin/env sh
userAtAddress="$1"; shift
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