How to get a consistent computer identifier for UNIX-like systems that's independent of how the computer connect to Internet?

In a Bash script, I use hostname -s to get my computer's name and use it as an identifier of the current computer where the script is running. The script does different things based on it. But hostname -s apparently can return different values depending on how the same computer connects to Internet. In most (normal) cases, it returns the name I set at System Preferences/Sharing/Computer Name. But I found when it connects to a VPN, hostname -s returns "vpnXXXXXX", which seems like a temporary identifier assigned by the VPN. Is there something else I should use to get a consistent identifier of the current computer?

link|improve this question

68% accept rate
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.