Also note that the FQDN should include the project name as well (this is
not being currently enforced, though), so I'd amend the script with:

labs() {
  host=$1
  proj=$2
  shift 2
  [[ -z "$proj" ]] && proj="<insert_your_default_project_here>"
  ssh "${host}.${proj}.eiad.wmflabs" "$@"
}


Marko


On 12 March 2016 at 23:42, Platonides <[email protected]> wrote:

> Aaron Halfaker wrote:
>
>> Hey folks,
>>
>> I have spent a little time today working out a cute little bash alias
>> trick for reducing my typing when connecting to various instances in
>> labs.  Adding the following code to your /.bash_alias/ (or just
>> /.bashrc/) file will change $ ssh <your instance>.eqiad.wmflabs to $
>> labs <your instance>.
>>
>>
>>     labs_ssh() {
>>        ssh $1.eqiad.wmflabs
>>     }
>>     alias labs=labs_ssh
>>
>>
>> And there you have it.  It's not much, but this helped my sanity a
>> little bit and I wanted to share.
>>
>
> Note that if you name the function labs, you won't need the alias. And you
> probably want to keep the ability to provide parameters to ssh, so:
>
> labs() {
>   hostname="$1.eqiad.wmflabs"
>   shift
>   ssh "$hostname" "$@"
>
> }
>
> _______________________________________________
> Labs-l mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/labs-l
>



-- 
Marko Obrovac, PhD
Senior Services Engineer
Wikimedia Foundation
_______________________________________________
Labs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/labs-l

Reply via email to