[Parted-maintainers] Bug#977046: Aw: Re: Bug#977046: parted: support pattern matching, e.g. parted -s /dev/sd[b-c] "print"
Werner.Heuser at web.de
Werner.Heuser at web.de
Sat Dec 12 16:21:13 GMT 2020
Hi Colin,
thank you for your fast and friendly answer. Yes, indeed
my suggestion is only small and it's easy to use
a loop instead, of course.
The idea came to me, when I used parted to
prepare some disks for RAID as well
as for LVM2. Both tools (e.g. mdadm, pvcreate) can
handle a list of devices out of the box. So I just
wondered why parted (and sfdisk) don't.
Best regards,
Werner
> Gesendet: Freitag, 11. Dezember 2020 um 10:53 Uhr
> Von: "Colin Watson" <cjwatson at debian.org>
> An: werner.heuser at web.de, 977046 at bugs.debian.org
> Betreff: Re: Bug#977046: parted: support pattern matching, e.g. parted -s /dev/sd[b-c] "print"
>
> On Thu, Dec 10, 2020 at 04:51:39PM +0100, Werner Heuser wrote:
> > please consider to support pattern matching, e.g.
> > parted -s /dev/sd[b-c] "print"
>
> The problem with anything like this would be that the shell would expand
> the pattern, so parted itself would see the argument list as:
>
> parted -s /dev/sdb /dev/sdc print
>
> The only ways I can think of to solve this would be:
>
> * use a different pattern syntax that doesn't collide with shell
> metacharacters (unlikely to be a good idea)
> * require users to quote the pattern to protect it from shell expansion
> (clumsy)
> * allow -s to take multiple device arguments until they stop looking
> like valid devices
>
> But I think this is special-purpose enough that it's unlikely to be
> worth the effort to implement in parted, when you could just use a shell
> loop instead (granted, it's longer, but it composes nicely and the
> meaning is unambiguous):
>
> for dev in /dev/sd[b-c]; do parted -s "$dev" print; done
>
> You're welcome to file your request directly upstream yourself, but
> since I'm not convinced that it should be implemented given the
> disadvantages, I don't currently plan to forward it.
>
> Thanks,
>
> --
> Colin Watson (he/him) [cjwatson at debian.org]
>
More information about the Parted-maintainers
mailing list