Hi, I have a question here. I am trying to invoke a command using my script. Please see the code below.
$Src_Cmd = "srvrmgr – g $GATEWAY –e $ENTERPRISE_SERVER –s $USER –p $PA +SSWD –c Run Task for comp $SYSTEM_NAME processName=\"UDA Batch Deplo +yment\", "RowId=$row_id"; #Subroutine to invoke the command sub Command_exe { ($COMMAND) = @_; print "Command to execute=$COMMAND\n"; $ret = system($COMMAND); if($ret == 0) { print "command executed successfully\n"; return 0; } else { print "Command Failed\n";return 1; } return 0; } #main------- $ret = Command_exe("$Src_Cmd"); # invoke the command line. print "ret code=$ret\n";
When i run this, it throws error. Do i need to write like this:
$Src_Cmd = "srvrmgr","– g","$GATEWAY","–e","$ENTERPRISE_SERVER","–s"," +$USER","–p","$PASSWD","–c",Run Task for comp $SYSTEM_NAME processName +=\"UDA Batch Deployment\", "RowId=$row_id";
Please suggest how to use the command? Cheers!! Ethen

In reply to How to run a command from Perl by Ethen

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.