http://www.perlmonks.org?node_id=539663

this has probably been done before and it's not that clever. but i find it useful - it saves me adding aliases to .bashrc for machines i commonly ssh to:
This goes in a directory which is added to my path, and then gets symlinked to. the name of the symlink being the target machine, or an abbreviation of it.

# ls ssh-targets: ssh.pl box1 -> ssh.pl box2 -> ssh.pl
so now typing box1 will ssh me to that machine (i then also obv get tab completion on machine names)
#!/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;