was [TriLUG] perl programming question. now more useless info/commentary
Andrew Perrin
andrew_perrin at unc.edu
Thu Mar 21 11:14:38 EST 2002
On Thu, 21 Mar 2002, John F Davis wrote:
> And just one more perl question:
>
> using a bash script, I can do something like this:
> sfdisk /dev/hde << EOF
> 0,174,6,-
> 174,174,83, *
> 348,173,83, -
> EOF
>
> That way, I can partition my microdrive in a script without creating a
> temporary file
> and doing:
> sfdisk /dev/hde < drivelayout.txt.
>
> Now, I am writing a similar script in perl and I need to do this same
> thing.
> I have the table read to build. That;s where the $drive$i question came
> up.
> Is there some way in perl to do a similar thing as the first example? maybe
> `sfdisk /dev/hde << EOF ...`?
>
> (If people hung out in #trilug, I could talk to you wonderful people in
> real time.)
>
> JD
There are several ways to do this; I would probably do something like the
following:
open(SFDISK, "|/path/to/sfdisk /dev/hde") or die "Oops! $!";
print SFDISK <<EOF;
0,174,6,-
174,174,83, *
348,173,83, -
EOF
close SFDISK;
Best,
Andy (hoping he's right this time....)
----------------------------------------------------------------------
Andrew J Perrin - andrew_perrin at unc.edu - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
269 Hamilton Hall, CB#3210, Chapel Hill, NC 27599-3210 USA
More information about the TriLUG
mailing list