Skip to content

Instantly share code, notes, and snippets.

@o0-o
Last active May 10, 2019 18:04
Show Gist options
  • Save o0-o/1d0dbce78dfc360f08904e5e3474d20e to your computer and use it in GitHub Desktop.
Save o0-o/1d0dbce78dfc360f08904e5e3474d20e to your computer and use it in GitHub Desktop.
[Serial Number] Retrieves the serial number of the host (if one exists) #Shell
# serial.sh
( # edgeos
show version |
grep "HW S/N:" ||
# linux/bsd x86
dmidecode --string system-serial-number ||
# macos
ioreg -l |
grep IOPlatformSerialNumber |
tr -d '"' ||
# linux/arm
grep --ignore-case serial /proc/cpuinfo
) 2>/dev/null |
awk '{print $NF}' ||
exit 1 #failure
exit 0 #success
# http://kb.mit.edu/confluence/pages/viewpage.action?pageId=152578725
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment