mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-25 19:35:37 +00:00
first attempt at cloud ssh
This commit is contained in:
parent
22d5131bca
commit
cb7b6b8f63
@ -107,3 +107,25 @@ unsetaws() {
|
||||
copy() {
|
||||
cat $1 | pbcopy
|
||||
}
|
||||
|
||||
cloud() {
|
||||
profile=${$1:-default}
|
||||
search=${2:-prod}
|
||||
num=${$3:-1}
|
||||
ips=$(drips --raw | grep $search)
|
||||
if [[ -z $ips ]]
|
||||
then
|
||||
echo "Failed to find instances."
|
||||
return 1
|
||||
fi
|
||||
count=$(echo $ips | wc -l)
|
||||
echo "Found ${count##*( )} instances."
|
||||
ip=$(echo $ips | sed -n "$num"p | awk -F' - ' '{print $2}')
|
||||
if [[ -z $ip ]]
|
||||
then
|
||||
echo "Not an available selection."
|
||||
return 1
|
||||
fi
|
||||
update-ssh-config --host $search --hostname $ip
|
||||
ssh $search
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user