[Parted-maintainers] Bug#977046: parted: support pattern matching, e.g. parted -s /dev/sd[b-c] "print"
    Colin Watson 
    cjwatson at debian.org
       
    Fri Dec 11 09:53:06 GMT 2020
    
    
  
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