Skip to content

Instantly share code, notes, and snippets.

View vinayan3's full-sized avatar

Vinay Anantharaman vinayan3

View GitHub Profile
@vinayan3
vinayan3 / gcloud_proxy_helper.sh
Created August 25, 2019 02:11
Google Cloud SQL Proxy Helper
#!/usr/bin/env bash
get_instances() {
local IFS=$'\n'
instances=($(gcloud sql instances list --format="table(name,database_version,region,STATUS, connectionName)"))
}
get_instances
for i in "${!instances[@]}"; do
[[ $i = 0 ]] && output="INDEX" || output="$i"