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

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -