I wonder if anybody has done this sort of stuff:
I need to use parted in a script doing a bit of a dodgy operation. I am trying to modify an extended partition that contains the partition I have been booted on so I am getting a confirmation request that leads to an error exit in script mode.
When I do this manually it works.
So I tried to pipe my input into parted to get around this with the following script:
#!/usr/bin/env bash
parted /dev/sda << EOT
resizepart
4
y
33593343s
Yes
I
EOT
This does not work unfortunately. I get
root@19912ac:/tmp# ./test.sh
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) resizepart
Partition number? 4
Warning: Partition /dev/sda4 is being used. Are you sure you want to continue?
(parted) y
align-check TYPE N
help [COMMAND] print general help, or help on COMMAND
mklabel,mktable LABEL-TYPE create a new disklabel (partition table)
mkpart PART-TYPE [FS-TYPE] START END make a partition
name NUMBER NAME name partition NUMBER as NAME
print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partition
quit exit program
rescue START END rescue a lost partition near START and END
resizepart NUMBER END resize partition NUMBER
rm NUMBER delete partition NUMBER
...
It looks like all goes well until I am asked to confirm the modification of /dev/sda4. My next input (y) shows up on the command line but after that I only get help infos.
Anybody tried this before ?