Created
May 4, 2016 08:56
-
-
Save markuskont/8643199caadf6f291c32f1dd6dc237c5 to your computer and use it in GitHub Desktop.
Get kind of unique number for system.
This file contains hidden or 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
#!/bin/bash | |
SERIAL=`sudo hdparm -I /dev/sda | grep 'Serial Number:' | perl -ne 'if(m/:\s*(\S+)/){print "$1\n"}' | tr -cd 0-9` | |
UNIQUE_FILE='/tmp/uniq.txt' | |
grep $SERIAL $UNIQUE_FILE > /dev/null 2>&1 || echo $SERIAL > $UNIQUE_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment