Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Wildcard in config files

24 views
Skip to first unread message

pk

unread,
May 24, 2012, 4:38:11 AM5/24/12
to
I know one can use wildcards and %h, %p etc. to simplify configuration, for
example

host a b c d
user myuser
hostname %h.example.com

so "ssh a" will get me to a.example.com, "ssh b" to b.example.com etc. Now I
have machines with the same names in another domain (say example.net), but
I'd like to use the same configuration pattern as above, perhaps naming the
hosts like "anet", "bnet" etc. or something like that. However, I can't do
this:

host anet bnet cnet dnet
user myuser
hostname %h.example.net

because %h will be replaced by "anet", "bnet" etc. and those machines don't
exist (they are a.example.net b.example.net etc.). This forces me to do

host anet
user myuser
hostname a.example.net

host bnet
user myuser
hostname b.example.net

etc. which will rapidly become tedious if there are many machines. Is there
a way to somehow mangle what ends up in %h? Or of course, another way to
get what I'm trying to do?

I can of course generate the config file programmatically, but I'd like to
make sure that I'm not missing something.

Thanks in advance.
0 new messages