Created
May 10, 2019 15:09
-
-
Save Chan9390/e639997ad577d1f7499fa1adf5d50857 to your computer and use it in GitHub Desktop.
Revisions
-
Chan9390 created this gist
May 10, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ echo Project Name,Disk Name,Source Image for projectname in `gcloud projects list --format json | jq -r '.[].projectId'`; do gcloud compute disks list -q --project $projectname --format json | \ jq -r '.[] | ["\(.name)", "\(.sourceImage)"] | @tsv' | \ while IFS=$'\t' read -r diskname sourceimage; do os=`echo $sourceimage | awk -F "/" '{print $NF}'`; echo $projectname,$diskname,$os; done; done