1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| #!/bin/bash
key="~/.ssh/aws.pem"
user[1]="ubuntu" user[2]="deployer"
ip[1]="xx.xxx.xxx.xxx" ip[2]="yy.yyy.yyy.yyy"
for ((i=1; i <= ${#user[@]}; i++)) do echo "${i})" ${user[$i]} done
read input[1]
user=${user[${input[1]}]}
for ((i=1; i <= ${#ip[@]}; i++)) do echo "${i})" ${ip[$i]} done
read input[2]
ip=${ip[${input[2]}]}
echo "Connecting to ${user}@${ip}...\n"
ssh -i "~/.ssh/aws.pem" "${user}@${ip}"
exit 0
|