Skip to content

Instantly share code, notes, and snippets.

@ryumada
Last active November 12, 2022 04:41
Show Gist options
  • Save ryumada/b7b6aeafb4ec02bdec57836e878d3474 to your computer and use it in GitHub Desktop.
Save ryumada/b7b6aeafb4ec02bdec57836e878d3474 to your computer and use it in GitHub Desktop.
Set the google project ID while doing Cloudskillboost labs in one copy-paste-enter command.

This command below will set the project ID given in Cloudskillboost Labs. The Project ID got from the project list name start with prefix "qwiklabs-gcp".

NOTE: If there are more than one projects given to you while doing the Cloudskillboost's lab, this command below will not work.

output=$(gcloud projects list | grep "PROJECT_ID: qwiklabs-gcp")
for word in $output
do
  if [ $(echo $word | grep "qwiklabs-gcp") ]
  then
    gcloud config set project $word
  fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment