help needed..........

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rohitkec
    New Member
    • Aug 2007
    • 9

    #1

    help needed..........

    I have to run a shell script from a perl script and where every function is called i have to insert a echo statement.
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    Originally posted by rohitkec
    I have to run a shell script from a perl script and where every function is called i have to insert a echo statement.

    Well, what have you tried so far? Please keep in mind that if you are calling a shell script from a Perl script, then the script will be run and the code inside executed. This means that you will have to have your echo statements already inside of your shell script.

    Please post the code you have tried and we can help you from there.

    Regards,

    Jeff

    Comment

    • rohitkec
      New Member
      • Aug 2007
      • 9

      #3
      sir,
      actually I am new to perl script.i have made a shell script:
      Code:
      #!/bin/bash
      a()
      {
      echo "in func f"
      }
      b()
      {
      echo "in func b"
      }
      a
      b
      then i have made a perl program:

      [CODE=perl]
      #!/usr/bin/perl
      use warnings;
      print `/home/rohit/perl/fun`;
      [/CODE]

      in this code I am able to run a shell script but i am not able to edit it.How can i place some more echo statements in shell script from perl program.
      Last edited by miller; Sep 3 '07, 06:30 PM. Reason: Code tag

      Comment

      • numberwhun
        Recognized Expert Moderator Specialist
        • May 2007
        • 3467

        #4
        First, I have deleted the post that you made before replying to this one as they were asking the same exact question. Please do not double post in the forums.


        Ok, in your code above, to execute the Perl script, you certainly don't need the print statement, just what follows it, in back tics.

        As for inserting echo statements into the perl script, you should have already had the needed echo statements in the shell script prior to execution. You cannot do it on the fly as the execution will happen outside of Perl's processing. You could possibly write some perl code to insert some echo statements into the script, prior to execution, but not during.

        Regards,

        Jeff

        Comment

        • miller
          Recognized Expert Top Contributor
          • Oct 2006
          • 1086

          #5
          Originally posted by rohitkec
          I have to run a shell script from a perl script and where every function is called i have to insert a echo statement.
          Your question makes absolutely no sense. Even seeing your code below it is unclear what you are trying to do.

          Please spell out clearly what you want and what you have already attempted.

          - Miller

          Comment

          • rohitkec
            New Member
            • Aug 2007
            • 9

            #6
            thanks , a lot ..........
            I got the solution .it has to be done by file handling .

            Comment

            Working...