justkar4u has asked for the wisdom of the Perl Monks concerning the following question:
## this modification does not work :(# # Include Files # use strict; use warnings; # # Variable Declarations and Initialization # my $char = '"'; my $cmd; our $device = ''; # # Main Script Body # #check if device name is supplied if($#ARGV == 0) { $device = $ARGV[0]; # store device name in variable # concatenate device name with fdisk command <b> $cmd = 'fdisk -c'.' '.$device.' < fdisk.input';</b> ###### +#This works system $cmd; exit 0; } else { print "Format Error:Usage- partition.pl <device_name>\n"; print "Example: partition.pl "; print $char; print "/dev/sdf"; print "$char\n"; exit -1; # displayed as 255 } ###### fdisk.input has these params: n p 1 1 +G t 83 w ####
nor does this work$cmd = 'fdisk -c'.' '.$device.' n p 1 1 +G t 83 w'; # this displays fdisk usage error
Thanks. - Ram$cmd = 'fdisk -c'.' '.$device; system $cmd; system " n p 1 1 +G t 83 w"; ## this however enters the fdisk prompt and waits for the above inputs + !!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: fdisk automation
by Corion (Patriarch) on May 27, 2011 at 19:00 UTC | |
by justkar4u (Novice) on Jun 03, 2011 at 19:20 UTC |