50 lines
829 B
Bash
Executable File
50 lines
829 B
Bash
Executable File
#!/bin/bash
|
|
|
|
|
|
while true; do
|
|
|
|
clear
|
|
|
|
echo "[1] - Format device as Fat32"
|
|
echo "[2] - Exit"
|
|
echo
|
|
echo -n ">>: "
|
|
read choice
|
|
|
|
|
|
if [ "${choice}" = "1" ];then
|
|
echo
|
|
lsblk
|
|
echo
|
|
echo -n "Type full path to device (/dev/xx1): "
|
|
read device
|
|
|
|
if [ ! -b "${device}" ]; then
|
|
echo "Error: ${device} is not a block device"
|
|
read -n 1 -p "Press any key..."
|
|
continue
|
|
fi
|
|
|
|
echo "WARNING: This will destroy ALL data on ${device}"
|
|
echo -n "Type 'YES' to confirm: "
|
|
read confirm
|
|
|
|
if [ "${confirm}" != "YES" ]; then
|
|
echo "Aborted."
|
|
read -n 1 -p "Press any key..."
|
|
continue
|
|
fi
|
|
|
|
mkfs.fat -F32 -v -n "FAT32" "${device}"
|
|
echo "Format complete."
|
|
read -n 1 -p "Press any key..."
|
|
elif [ "${choice}" = "2" ];then
|
|
break
|
|
else
|
|
echo "Invalid option"
|
|
read -n 1 -p "Press any key..."
|
|
fi
|
|
|
|
done
|
|
|