I am not good in bash, i can do basic but when it comes into multiple if statements, then i am a no brainer for them.
I currently have the following statement made.
var=$(cat /sys/block/vda/queue/rotational) dtype='nil' if [ $var = 0 ]; then dtype=' SSD ' elif [ $var = 1 ]; then dtype=' HDD ' fi
Since many machines use sda instead of vda, im looking for a way to make it that there would be multiple? if statements (atleast thats how i understand it)
If the first
var=$(cat /sys/block/vda/queue/rotational) command gives me and error, it would not print that one out. and it would choose this command instead. (Only if the first one is not working)
var1=$(cat /sys/block/sda/queue/rotational) dtype='nil' if [ $var = 0 ]; then dtype=' SSD ' elif [ $var = 1 ]; then dtype=' HDD ' fi