How to Detect the Presence of USB Flash Drive in Linux bash script?

Hello,

I'm using Linux Fedora 14 Distro.

I need to detect the presence of a USB flash drive in a bash script and then make one of two choices based on whether it's there or not.

How can I do this?  Specific code is greatly appreciated.

Thanks,
Jason
SqueezeOJAsked:
Who is Participating?
 
SqueezeOJAuthor Commented:
Thanks Abhishek_Chib!

Here's the code I generated from that link:

if sudo lshw | grep "label=MyUSBDrive" ; then
  echo "Flash Drive Available"
else
  echo "Flash Drive NOT Available"
fi

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.