As that was a bit of an interesting puzzle:
#!/bin/bash
# Basic HDD detection script. # Written by Rob Thomas, <email address hidden> # Code available under the licence of your choice.
ALLDISKS=$(parted -lms | awk 'found{ if(!/dev\/mapper/){print};found=0} /^BYT;$/{found=1}')
while read -r l; do RAWDISK=`echo "$l" | cut -d: -f1 | sed -r 's/\//!/g; s/!dev!//'` SSD="?" if [ -e "/sys/block/$RAWDISK/queue/rotational" ]; then SSD=`cat /sys/block/$RAWDISK/queue/rotational` fi echo $l$SSD done <<< "$ALLDISKS"
That will append ? (if there's an error), 0 or 1 to the end of the string
As that was a bit of an interesting puzzle:
#!/bin/bash
# Basic HDD detection script.
# Written by Rob Thomas, <email address hidden>
# Code available under the licence of your choice.
ALLDISKS=$(parted -lms | awk 'found{ if(!/dev\ /mapper/ ){print} ;found= 0} /^BYT;$/{found=1}')
while read -r l; do
RAWDISK= `echo "$l" | cut -d: -f1 | sed -r 's/\//!/g; s/!dev!//'` $RAWDISK/ queue/rotationa l" ]; then
SSD=` cat /sys/block/ $RAWDISK/ queue/rotationa l`
SSD="?"
if [ -e "/sys/block/
fi
echo $l$SSD
done <<< "$ALLDISKS"
That will append ? (if there's an error), 0 or 1 to the end of the string