Wrong partition name used for devices ending with numbers

On Linux when a block device ends with a number (like my SD card device: **/dev/mmcblk0**) the first partition is called **/dev/mmcblk0p1** (with an added **p**). This snippet makes sure that the correct partition name is used in both cases.
This commit is contained in:
Dag Wieers 2013-04-21 22:28:41 +02:00
parent 14e958d5a6
commit ac14d279c3

View File

@ -42,7 +42,12 @@ if [ -z "$1" ]; then
fi
DISK="$1"
PART="${DISK}1"
### If DISK ends with a number, add "p1" instead of "1" for the first partition
case "${DISK: -1:1}" in
([0-9]) PART="${DISK}p1";;
(*) PART="${DISK}1";;
esac
clear
echo "#########################################################"