[Adding mailing list again] Well I wish I could say I invented it, but I didn't, I adapted it from various online answers: https://stackoverflow.com/a/53695968 https://stackoverflow.com/a/35562413 https://unix.stackexchange.com/questions/436200/different-ways-to-use-dev-tcp-host-port-command-and-where-to-find-manual-pages#comment788048_436200 One problem with it could be that there is no timeout (your version had a 2 second timeout). I don't know if this matters, because I assume that once we know it's Alibaba Cloud, then the 100.100.100.200 address is either there or not there, so perhaps a timeout is not needed? If a timeout is needed then implementing this in pure bash is more of a problem. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org