Hey everyone. First of all, I just want to say thanks for such a great and comprehensive perl community. As someone who is just starting in perl, perlmonks has proved to be an invaluable resource. Thanks to all who post questions and answers that keep me excited about moving forward with perl! (It's easy to want to call it quits when stuck in a jam)

Now to my question(s). I am writing a perl program that will image many cards at once. I am new to programming, but I am very experienced with linux. I used to image the cards using a bash script that would just dd the image to the sd card.

Ultimately, I want the script to allow the user to configure the card slots and an ID number for each card via a config file. I then want the program to read the config file, ask the user for confirmation, and then write to all the cards. I have the config file and many of my other little issues taken care of (thanks in large part to perl monks!). However, I have been unable to find an efficient way to issue many DD commands at once. For example, say that there are 5 card slots entered (/dev/sdb, /dev/sdc, etc (the partition number is not applicable as the dd image includes it's own partitions)). How would I enable my perl program to DD a file to all of those slots, ideally at the same time? The slots are $slot1, $slot2, $slot3, etc.

On my linux system, I generally pipe my DD commands through PV (pipe viewer) so that I may view the transfer rate, elapsed time, and other data that let's me know how it's going. I tried to do this with the system command from my perl script, but I wasn't given any progress, rather just the initial bar at 0. I understand why this is happening (essentially), and I was wondering if anyone would have a workaround on how I could get the output of PV in to my perl program so as to allow the user to view the status of the copies.

I am running these on a debian linux system. I'm sorry if my question is wordy, I appreciate the time and effort of everyone out there. I will be more than happy to clarify anything that may be unclear with my question. Thank you all very much.


In reply to Pipe DD command? by Erin.Gossamer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.