Reducing host entries in config file

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Is there any way to replace many entries in ssh config file:
Host 10
Host 11
etc. with something like this ($1 is first parameter in bash):
Host $1
  Hostname 10.1.0.$1
Every time I execute ssh $number, ssh should connect with 10.1.0.$number.
I can't use domain names because they are very long (i-10-0-0-10) and
these hosts are in different domain than client host. Any ideas?


Re: Reducing host entries in config file

Quoted text here. Click to load it

I don't know of any way to simplify the /contents/ of the ssh_config

However, if /building/ the ssh_config file is an issue, then you /
could/ just automate this portion of it....

for number in `seq 1 255` ;
  echo Host $number >>ssh_config
  echo "  Hostname 10.1.0.$number" >>ssh_config

Lew Pitcher
Master Codewright & JOAT-in-training   | Registered Linux User #112576
Me: | Just Linux: /
----------      Slackware - Because I know what I'm doing.

Site Timeline