Loading ...
Sorry, an error occurred while loading the content.

what's the source of the error here? (system command)

Expand Messages
  • john maclean
    what s up with line six? The command seems fine to me :-/ cat test_dd.pl #!/usr/bin/env perl -w use strict; use warnings; my $dd_file_size = 2*10*(2**10); #
    Message 1 of 2 , Jun 5, 2010
    • 0 Attachment
      what's up with line six? The command seems fine to me :-/

      cat test_dd.pl
      #!/usr/bin/env perl -w
      use strict;
      use warnings;

      my $dd_file_size = 2*10*(2**10); # 10GB
      system("dd if=/dev/zero of=/Users/jayeola/virt/running/dumb.img
      seek=$dd_file_size count=1") or die "failed dd"


      perl test_dd.pl
      1+0 records in
      1+0 records out
      512 bytes transferred in 0.000033 secs (15561476 bytes/sec)
      failed dd at test_dd.pl line 6.



      --
      John Maclean
      07739 171 531
      MSc (DIC)

      Enterprise Linux Systems Engineer
    • merlyn@stonehenge.com
      ... john system( dd if=/dev/zero of=/Users/jayeola/virt/running/dumb.img john seek=$dd_file_size count=1 ) or die failed dd perldoc -f system says: system
      Message 2 of 2 , Jun 6, 2010
      • 0 Attachment
        >>>>> "john" == john maclean <jayeola@...> writes:

        john> system("dd if=/dev/zero of=/Users/jayeola/virt/running/dumb.img
        john> seek=$dd_file_size count=1") or die "failed dd"

        perldoc -f system says:

        system LIST
        system PROGRAM LIST
        [...]
        The return value is the exit status of the program as returned
        by the "wait" call. To get the actual exit value, shift right by
        eight (see below).

        The exit code is *zero* when everything worked OK, so in effect, you're
        saying "die if everything worked"!

        --
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
        <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
        Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
        See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
      Your message has been successfully submitted and would be delivered to recipients shortly.