Re: Please check my sudo bash script
On Sun, Aug 31, 2025 at 7:56 AM Tom Browder <tom.browder@gmail.com> wrote:
> Does this bash fragment look safe for using bash vars for the first disk:
> SDX=sda
> sudo parted /dev/${SDX} mklabel gpt
> sudo parted -a opt /dev/${SDX} mkpart primary ext4=0% 100%
> sudo mkfs.ext4 /dev/${SDX}
Nope.
See, e.g.:
https://www.mpaoli.net/~michael/unix/sh/#Good_Programming_Practices
notably including:
check return/exit values
do something reasonable even when things fail unexpectedly
And why are you mucking with partitions if you're putting filesystem
on the drive device itself, or is that yet another issue?
Reply to: