Is there any way to find out if a given device exists?
I have a small script that asks user to type in name of a device and I want to check if the device exists in /dev dir.
So far I have:
echo -n "HDD -> "
while [ ! -d /dev/$hdd ]
echo -n "Doesn't Exist. Try Again. HDD -> "
The only problem is that the while statement checks for DIRECTORIES instead of devices. So if that code should work for any folder that exists in /dev. However, hda, hdb, sda are devices and therefore don't count as dir and thus don't pass that statement.
Please Help. I am very new to linux and I already did some research before turning to experts here.