[X-Unix] how to determine if FW drive is attached

Timothy Luoma lists at tntluoma.com
Mon Sep 5 20:06:35 PDT 2005


I am using the script below to determine whether or not my Maxtor  
external FW drive is attached (not necessarily mounted, just  
physically just attached).


#!/bin/sh

FWDRIVE_ATTACHED=`system_profiler |\
     fgrep -B2 'GUID: 0x10B920003D6BFB' |\
     tr '\012' ' ' |\
     sed 's#  *# #g' `

IS_ATTACHED=" Manufacturer: Maxtor Model: 0x3020 GUID:  
0x10B920003D6BFB "

if [ "$IS_ATTACHED" = "$FWDRIVE_ATTACHED" ]
then

     echo "FW drive is attached"

else

     echo "FW drive is not attached"

fi

exit 0
#EOF

There are a lot of Apple-specific utilities that I'm not familiar  
with.  I'm trying to figure out if there is a way to do this w/o  
using 'system_profiler' which is fairly CPU intensive.

TjL



More information about the X-Unix mailing list