so now typing box1 will ssh me to that machine (i then also obv get tab completion on machine names)# ls ssh-targets: ssh.pl box1 -> ssh.pl box2 -> ssh.pl
#!/usr/bin/perl my $file=$0; # what machine are we looking at? $file=~s#^(?:.*/)?([^/]+)$#$1#; my $dest; # a config hash for expanding the name, and choosing the user. my $places={ box=>{full=>"boxwithlongname"}, home=>{full=>"blahblah",user=>"alexk"} }; # if i have many machines with the same long name - abbreviate to box # (as in hash above), so box1 goes to boxwithlongname1 etc my ($short,$number)=$file=~/^(\D+)(\d?)$/; my $hash=$places->{$short}; $dest=$hash->{full}?$hash->{full}.$number:$file; $user=$hash->{user}||"alex"; # and ssh to it. exec("ssh $user\@$dest @ARGV") if $dest;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: ssh wrapper
by tirwhan (Abbot) on Mar 28, 2006 at 10:29 UTC | |
by teamster_jr (Curate) on Mar 28, 2006 at 10:33 UTC | |
Re: ssh wrapper
by radiantmatrix (Parson) on Mar 28, 2006 at 18:33 UTC |