Quick System Info – BASH

Here is a BASH script to get basic system inventory information about your computer and parse it into CSV format.

#!/bin/bash
FIELDS="\"ComputerName\",\"Manufacturer\","
FIELDS+="\"Model\",\"ServiceTag\",\"Memory\","
MYHOSTNAME="$(hostname)"
MANUFACTURER="$(dmidecode -s system-manufacturer)"
MODEL="$(dmidecode -s system-product-name)"
SERVICETAG="$(dmidecode -s system-serial-number)"
MEMORY="$(free |grep "Mem:" |awk '{print $2}')"
MYINFO=\""${MYHOSTNAME}"\",\""${MANUFACTURER}"\",
MYINFO+=\""${MODEL}"\",\""${SERVICETAG}"\",
MYINFO+=\""${MEMORY}"\",
echo "${FIELDS}"$'\n'"${MYINFO}"