hello,
I have the following script to check if drives exist.
Code:
#!/bin/bash
SDB=/dev/sdb
SDC=/dev/sdc
SDD=/dev/sdd
SDE=/dev/sde
SDF=/dev/sdf
if [ -b $SDB ]; then
echo "$SDB drive present. continuing."
else
exit 1
fi
if [ -b $SDC ]; then
echo "$SDC drive present. continuing."
else
exit 1
fi
if [ -b $SDD ]; then
echo "$SDD drive present. continuing."
else
exit 1
fi
if [ -b $SDE ]; then
echo "$SDE drive present. continuing."
else
exit 1
fi
if [ -b $SDF ]; then
echo "$SDF drive present. continuing."
else
exit 1
fi
Is there a better method (one or two liner) that would do the same thing instead of using multiple if statements?
Thanks,