environment variable env var is a name-value pair stores configuration information for your operating system and applications programs can access it when needed some are automatically set by your operating system during startup some applications might create environment variables during installation users can create them also may also set or modify environment variables directly on the fly using command export env vars are not stored in a single central location as i understood they are loaded from different places into memory Win Search for Advanced system settings in Windows Click the Advanced tab Click the Environment Variables button in the bottom At work I had to use User variable window Mac printenv show environment variables echo $ var_name show specific variable value export var_name = value set var temporarily in terminal session code ~/.zshrc , then add export var_name = value , then source ~/.zshrc to add variable permanently into terminal profile Save var in session and use it in script
# to get project ID
gcloud projects list
# set your project id in here
export PROJECT_ID="your-project-id"
# later use variable in script
gcloud iam service-accounts create "cloud-run-sa" --project="${PROJECT_ID}" --description="Cloud Run Service Account" --display-name="Cloud Run Service Account
PATH how does terminal know what executable to launch when we type docker terminal searches for "docker" file inside folders listed at PATH env variable we can check where executable is with where docker