Environment: CentOS6.4
Objective:
If you need to SSH to the required machine, you need to enter the command:
SSH [Email protected]
If you need to log on to the machine frequently, is not a bit of trouble, IP old hard to remember, if I just need to enter the following command:
Go HC
Of course, this HC is just a mapping code, which means I'm going to a machine.
In summary, provide a piece of code, quickly mapping, find the specified machine and SSH past, the code is as follows:
if[" $"==""]; Then Echo "Not found paramter! please input paramter!"Exit-1fifunctiongo_ssh () {if[" $"==" $"]; Then Echo "found mapping, command:ssh [email protected]$4" SSH$3@$4Exit0 fi}go_ssh $ 1 "HC" root 10.127.133.86go_ssh "hn1" root 10.127.133.87go_ssh "hn2" root 10.127.133.88Echo "Not found mapping [$], fail! fail! fail!"Exit-1
Note: Here the Red Place is a place to pay attention, you just need to expand here, you can easily manage the mapping relationship.
Not only that, you also need to put the code in the path of the system, you need the echo $path, and then put it in any directory.
Finish.
Use the go command to quickly ssh to a specified machine