bash - How to check if docker machine exists programmatically? -


i'm using docker-machine manage cloud servers. i'm writing bash scripts automate tasks. question is: "how check in bash script if docker machine specific name exists?". need expression return true if exists , false if doesn't.

thanks

just run through grep, if regexp enough you. example if have machine called foo:

$ docker-machine ls -q | grep '^foo$' 

should work , return 0. caret matches start of line , space avoids partial matches. if doesn't match non-zero return code.


Comments

Popular posts from this blog

xslt - Substring before throwing error -

Google Cloud Bigtable Durability/Availability Guarantees -

c# - Call C++ Native DLL in Managed Code -