Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    May 2007
    Posts
    162
    Thanks
    13
    Thanked 0 Times in 0 Posts

    How to pass arguments from perl to shell script

    I have a shell script like this:

    #!/bin/sh
    $PYTHON MetarDecoder.py < ../data/mtrs/arg1/arg2

    And I'm calling it with this:

    my $output = `./metar_parse.sh --option`;

    It's successful when I put in values for arg1 and arg2 in the shell script, but I'd like to pass arguments from the perl script (defining them in perl script) to the shell script so I can have different arguments depending on date/time, etc.

    Thanks for any help!
    S

  • #2
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    2,912
    Thanks
    2
    Thanked 164 Times in 159 Posts
    On the Perl side it would be as simple as:
    Code:
    my $option1 = 'some option';
    my $option2 = 'some other option';
    my $output = `./metar_parse.sh $option1 $option2`;
    If you need help in coding the shell script to accept arguments, then you need to post that question in a shell scripting forum.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •