Bash script to format a block device (hard drive or Flash drive) in UDF. The output is a drive that can be used for reading/writing across multiple operating system families: Windows, macOS, and Linux. This script should be capable of running in macOS or in Linux.
Please consider to allow /dev/ prefix for the device name. So both formats will be possible:
without /dev/ - e.g. sdb or sdb2
with /dev/ - e.g. /dev/sdb or /dev/sdb2
I see that /dev/$DEVICE pattern is used many times in your script so I think better is to check at the beginning if has the /dev/ prefix and add it if not. Then you can use simple $DEVICE instead of /dev/$DEVICE.
Suggested by @lucky62 in #24:
Please consider to allow
/dev/
prefix for the device name. So both formats will be possible:/dev/
- e.g. sdb or sdb2/dev/
- e.g. /dev/sdb or /dev/sdb2I see that
/dev/$DEVICE
pattern is used many times in your script so I think better is to check at the beginning if has the/dev/
prefix and add it if not. Then you can use simple$DEVICE
instead of/dev/$DEVICE
.