less than 1 minute read

$ curl -s http://support-sp.apple.com/sp/product?cc=`system_profiler SPHardwareDataType | awk '/Serial/ {print $4}' | cut -c 9-` | sed 's|.*<configCode>\(.*\)</configCode>.*|\1|'
MacBook Air (13-inch, Late 2010)

AWK 명령어로 Serial로 시작하는 줄에서 시리얼 번호를 추출. cut 명령어로 마지막 문자 4개만 남기고 잘라낸다. 응답으로 받은 문자열에서 태그 내용을 sed로 치환.

모델명 출력하고 나니 따끈따끈한 신상 맥북 사고 싶다.

참고