Hello, thank you for packaging parted. I currently have this in a deploy script: DISK=`find_disk` while read -r cmd; do parted -s -a optimal $DISK $cmd; done < commands.txt that while loop works around parted only accepting script commands on the command line. I wish I could do this: DISK=`find_disk` parted -s -a optimal $DISK read commands.txt or this: DISK=`find_disk` compute_parted_commands | parted -s -a optimal $DISK read - I understand that running each command in its own invocation makes it possible to know which command exactly failed. In my case, though, I work on an all-or-nothing situation: either the disk ends up partitioned how we need it, or the installation procedure alarms[1] and halts. Enrico [1] it really does: it even plays a morse code SOS on the PC speaker :)
Does it help to know (as I don't think it's well-documented) that all parted commands apart from "help" can unambiguously determine when their arguments end? "parted -s" actually just works by popping a command name from the command line, having that command pop arguments until it's finished, popping another command name if possible, and repeating until it runs out of words. So, for example, you can do this: parted -s $DISK print unit s print ... and that's parsed as: print unit s print This is a bit weird and so doesn't necessarily obviate your request, of course, but it should let you just do this or some nearby variation: DISK=`find_disk` compute_parted_commands | xargs parted -s -a optimal $DISK Cheers,
In fact I now see that this is documented in "info parted", under "Running Parted". So I think you can safely rely on this.