I would like to run a bash script which invokes a command and then sets a variable in the script with a part of the output from the first command. In my case I would like to set the variable
gcloud run deploy loady # echo $URL <--- how to set this with the output from the above command
When I run my script (example output):
karl@Karls-MacBook-Pro ~ $ ./my-script.sh Deploying container to Cloud Run service (loady) in project (loady) region (us-central1) ✓ Deploying new service... Done. ✓ Creating Revision... ✓ Routing traffic... ✓ Setting IAM Policy... Done. Service (loady) revision (loady-00001-nod) has been deployed and is serving 100 percent of traffic. Service URL: https://loady-7jmiymbtlg-uc.a.run.app
So as you can see, the last line there.