So I basically am trying to overwrite my ssh
command so I only have to type ssh
and by default it would connect to my main server. Then if I passed it an argument, say username@server_port
it would then run the basic command.
# Fast SSH (a working progress) TODO: make work without naming the function `fssh`
function fssh() {
ALEX_SERVER_CONNECTION=$ALEX_SERVER_UNAME@$ALEX_SERVER_PORT
# if the `ssh` argument is not set
if [ -z "${1+xxx}" ]; then
# echo "ALEX_SERVER_CONNECTION is not set at all";
ssh $ALEX_SERVER_CONNECTION
fi
# if the `ssh` argument is set
if [ -z "$1" ] && [ "${1+xxx}" = "xxx" ]; then
ssh $1
fi
}
How do I get it to work without the f
in front of the ssh
?
So basically this is how it looks when properly done:
# Fast SSH
function ssh() {
ALEX_SERVER_CONNECTION=$ALEX_SERVER_UNAME@$ALEX_SERVER_PORT
# if the `ssh` argument is not set
if [ -z "${1+xxx}" ]; then # ssh to the default server
command ssh $ALEX_SERVER_CONNECTION
fi
# if the `ssh` argument is set
if [ -z "$1" ] && [ "${1+xxx}" = "xxx" ]; then # ssh using a different server
command ssh $1
fi
}