in reply to fdisk automation

system does not send keys to other programs, so your approach cannot work.

I recommend using sfdisk instead of fdisk, because sfdisk takes all parameters on the command line.

If you really, really want to automate entering keys into fdisk, take a look at Expect, or treat fdisk as a pipe:

my $cmd = "/usr/sbin/fdisk -c $device"; open my $fdisk, "| $cmd" or die "Couldn't spawn [$cmd]: $!"; for my $command ("n", "p", "1", "1", "+G", "t", "83", "w") { print $fdisk "$command\n"; };

Replies are listed 'Best First'.
Re^2: fdisk automation
by justkar4u (Novice) on Jun 03, 2011 at 19:20 UTC
    Thanks a lot !