I was writing a shell script that wipes, partitions and formats the selected drive when I ran into some trouble with nvme drives.
Essentially what I am trying to accomplish is a way to use the * wildcard in the if statement below to check if the drive is an nvme drive or not so I can then declare variables for the partitions to use later in the script.
This is the relevant part of the script right now:
if [ "$DRIVE" == "/dev/nvme*" ] ; then
DRIVEp1="${DRIVE}p1"
DRIVEp2="${DRIVE}p2"
DRIVEp3="${DRIVE}p3"
else
DRIVEp1=${DRIVE}1"
DRIVEp2=${DRIVE}2"
DRIVEp3=${DRIVE}3"
fi
When I run the script as is and have $DRIVE set to "/dev/nvme0n1", the script ignores the match and goes to the else clause.