how to execute shell file in perl?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gopinath
    New Member
    • Feb 2014
    • 1

    how to execute shell file in perl?

    i have shell file which will execute set commands to activate the mesh interface in my CRB board.
    in my perl file i tried to execute using system(location of file);
    but am not getting correct output but it is returning true...

    my code

    $mesh_base="/mnt/jffs2/conf/mesh_start";
    system($mesh_ba se);
  • RonB
    Recognized Expert Contributor
    • Jun 2009
    • 589

    #2
    You don't have any error checking/handling on that system call, so how do you know it's returning true?

    What output are you getting and how does that differ from what you expect?

    Comment

    • miller
      Recognized Expert Top Contributor
      • Oct 2006
      • 1086

      #3
      As RonB pointed out, you aren't checking to see if system succeeded. According to perldoc system, a true return value would actually be an indication of failure. If you don't want to worry about explicitly checking for success, use the autodie pragma.

      Code:
      use strict;
      use warnings;
      use autodie qw(:all);
      
      my $mesh_base = '/mnt/jffs2/conf/mesh_start"'
      system($mesh_base);
      - Miller

      Comment

      Working...