I am trying to create a simple alias for SSH-ing to a host, like the below:

alias wpessh='ssh $1@$1.ssh.wpengine.net'

I also tried using a function as suggested by other answers here:

function wpessh { ssh "$1"@"$1".ssh.wpengine.net; }
export -f wpessh

But neither has worked.


wpessh mysite

Expected Output (expected command to be run)

ssh [email protected]
  • What shell are you using? What happens if you add an echo for debugging purposes, i.e. function wpessh { echo ssh "$1"@"$1".ssh.wpengine.net; }
    – Sparhawk
    Oct 29, 2018 at 9:44
  • @Sparhawk I'm just using OSX terminal. If I echo the function as you describe, I receive the SSH usage:[....]
    – wickywills
    Oct 29, 2018 at 9:59
  • What's the $1 contents when issuing the alias? What's the resulting command (try set -x)? Why the upper case SSH in the error msgs?
    – RudiC
    Oct 29, 2018 at 10:02
  • check this out unix.stackexchange.com/questions/3773/… it may be helpful Oct 29, 2018 at 10:05
  • 1
    @wickywills I executed the function wpessh { echo ssh "$1"@"$1".ssh.wpengine.net; } in my OSX Shell both in bash and zsh and it's working fine. Oct 29, 2018 at 10:57


You must log in to answer this question.

Browse other questions tagged .