user3134453
user3134453

Reputation: 233

customize ssh command in ubuntu

I'm trying to customize the ssh command in ubuntu using the ~/.bash_aliases file, basically I want to use the command 'zssh |$value|' to do: ssh root@name|$valuegoeshere|.hostname.org, I have tried to use this code:

function zssh{ssh root@name$1.hostname.org}

However I got the following error:

bash: /home/amirs/.bash_aliases: line 1: syntax error near unexpected token root@name$1.hostname.org}' bash: /home/amirs/.bash_aliases: line 1:function zssh{ssh root@name$1.hostname.org}'

Any suggestions on how to configure the following function?

Upvotes: 0

Views: 125

Answers (1)

Barmar
Barmar

Reputation: 781098

The correct way to define a function is:

zssh () {
    ssh root@name$1.hostname.org
}

The function keyword is optional and a bash extension, so there's no need to use it. You need whitespace around the { character, and there has to be a command delimiter (either newline or ;) before }.

Upvotes: 1

Related Questions