Created
July 1, 2014 04:01
-
-
Save alice-xu/ad8b4ad8c9a85135d6c3 to your computer and use it in GitHub Desktop.
Get system uuid on Virtual Machine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
SYSTEM_UUID=$( cat /sys/devices/virtual/dmi/id/product_uuid 2> /dev/null | tr 'A-Z' 'a-z' \ | |
|| cat /sys/hypervisor/uuid 2> /dev/null | tr 'A-Z' 'a-z' ) | |
[ -z "${SYSTEM_UUID}" ] && SYSTEM_UUID='00000000-0000-0000-0000-000000000000' | |
echo ${SYSTEM_UUID} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment