sysadmin:ssh_conf
This is an old revision of the document!
SSH Access Script
Difficulty [1-10]: 1
If you have an SSH config file, and don't want to remember all the entries (in my case, with home and work, my list is about 50 entries)
Location: /opt/DBA/scripts/xmen
#!/bin/bash
typeset -i looper=0
typeset -A hostArray
while read comment hostName
do
is_break=`echo $comment | cut -c 1-2`
if [ ${is_break} == "#_" ]; then
echo "-----------------------------------------------------------"
else
looper=$looper+1
hostArray[$looper]=$hostName
echo "${looper}) $hostName"
fi
done <<< $(cat ~mlivolsi/.ssh/config | egrep 'Host|#_' | grep -v 'HostName' | grep -v 'StrictHostKeyChecking' | grep -v 'UserKnownHostsFile' | grep -v 'HostKeyAlgorithms' )
echo -e "===> \c"
read answer
ssh "${hostArray[$answer]}"
sysadmin/ssh_conf.1763742258.txt.gz · Last modified: by mlivolsi
