You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
257 B

#!/bin/bash
which dmidecode >/dev/null
if [ $? -ne 0 ]; then
echo dmidecode not found
exit 1
fi
serial=`dmidecode | grep -im1 'serial number' | cut -d' ' -f3 | tr -d [:space:]`
if [ ${#serial} -eq 0 ]; then
echo no serial found
exit 1
fi
echo $serial