1
I need to supply either '-name'
or '-sname'
when starting an Erlang VM depending on whether the given string is a fully qualified name (FQDN) or not. What would be the quickest and environment-independent way of validating that? I am more interested in using some bash command (like 'getent'
or 'nslookup'
or others) rather than a regex expression. Best if it works in Ubuntu, FreeBSD and Solaris without changes and can be used in bash's 'if'
easily.
Pretty much any string can be a valid fqdn provided it has a dot in it or at the end, so a lookup is the only way to be certain. – Paul – 2014-05-06T14:04:42.827
You mean nslookup? That's what I mean. I want to make a lookup to be certain. I am just not sure if 'nslookup' is the way to go or maybe 'host' instead or something else? – Greg – 2014-05-06T14:06:03.537
it seems like it might be a better idea to target a python or perl method instead of shelling a utility. shells change all the time, but a system with python3 will always run the same method correctly, regardless of what platform its installed on, and how that platform is configured. – Frank Thomas – 2014-05-06T15:00:45.377
I just need to use it in an existing bash script when starting an Erlang node. Adding dependency on Python or Perl would be an overkill in my opinion. – Greg – 2014-05-06T16:45:46.747