system command failed

Discussion in 'Perl Misc' started by shurikgefter@gmail.com, Sep 9, 2008.

  1. Guest

    Hi,

    I have the following line in my script:

    system ( "export A=10; myScript.pl param1 par^AAA^da " );

    When I run it in Unix I get the following error:

    sh: can execute AAA

    Please advice what is ^*^

    Thanks
     
    , Sep 9, 2008
    #1
    1. Advertising

  2. On Tue, 09 Sep 2008 12:11:31 -0700, wrote:

    > Hi,
    >
    > I have the following line in my script:
    >
    > system ( "export A=10; myScript.pl param1 par^AAA^da " );
    >
    > When I run it in Unix I get the following error:
    >
    > sh: can execute AAA
    >
    > Please advice what is ^*^
    >
    > Thanks


    This is not a Perl problem but a shell problem. You should probably ask
    in comp.unix.shell. Don't forget to tell them what shell you are running.

    Regards,

    Leon
     
    Leon Timmermans, Sep 9, 2008
    #2
    1. Advertising

  3. J. Gleixner Guest

    wrote:
    > Hi,
    >
    > I have the following line in my script:
    >
    > system ( "export A=10; myScript.pl param1 par^AAA^da " );
    >
    > When I run it in Unix I get the following error:
    >
    > sh: can execute AAA


    How do you 'get' that error?

    >
    > Please advice what is ^*^


    Ahhhh.. What are you asking? Where is '^*^'?

    Maybe you should look at or post 'myScript.pl'.
     
    J. Gleixner, Sep 9, 2008
    #3
  4. smallpond Guest

    On Sep 9, 3:11 pm, "" <>
    wrote:
    > Hi,
    >
    > I have the following line in my script:
    >
    > system ( "export A=10; myScript.pl param1 par^AAA^da " );
    >
    > When I run it in Unix I get the following error:
    >
    > sh: can execute AAA
    >
    > Please advice what is ^*^
    >
    > Thanks


    ^*^ appears to be the rarely used emoticon for a flying hedgehog.

    My guess is you have a typo or editor artifact in your script.

    --S
     
    smallpond, Sep 9, 2008
    #4
  5. "" <> wrote:
    >system ( "export A=10; myScript.pl param1 par^AAA^da " );
    >When I run it in Unix I get the following error:
    >
    >sh: can execute AAA


    Well, that's great that sh is able to execute AAA. Where is the problem?

    jue
     
    Jürgen Exner, Sep 9, 2008
    #5
  6. In article <>,
    <> wrote:
    >Hi,
    >
    >I have the following line in my script:
    >
    >system ( "export A=10; myScript.pl param1 par^AAA^da " );
    >
    >When I run it in Unix I get the following error:
    >
    >sh: can execute AAA


    In some shells, the ^ character means the same thing as the | character --
    pipe the output of one command into the input of another. So your shell
    appears to be trying to run the commands "myscript.pl param1 par", "AAA", and
    "da".

    I can think of two ways to fix this:

    1) (more Perl-ish)

    $ENV{A}=10;
    system 'myScript.pl', 'param1', 'par^AAA^da';

    This allows this Perl script to call myScript.pl directly, without
    requiring a shell to parse the command line, so the characters that
    are special to the shell don't get processed.

    (It does set the environment variable A for the rest of this script's
    run; there are workarounds if that's a potential issue.)

    2) (minimal changes to this script)

    system ( "export A=10; myScript.pl param1 'par^AAA^da' " );

    The single quotes in this string will be included in the command
    passed to the shell, and will prevent the shell from processing special
    characters inside the quotes when it parses the arguments for myScript.pl.

    >Please advice what is ^*^


    That looks like it might be a rather impolite emoticon.

    Gary Ansok
    --
    The recipe says "toss lightly," but I suppose that depends
    on how much you eat and how bad the cramps get. - J. Lileks
     
    Gary E. Ansok, Sep 10, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Irmen de Jong
    Replies:
    2
    Views:
    450
    =?ISO-8859-1?Q?Gerhard_H=E4ring?=
    Aug 12, 2003
  2. sck10
    Replies:
    6
    Views:
    963
    sck10
    Sep 1, 2006
  3. boriq
    Replies:
    4
    Views:
    630
    Tim Golden
    Jun 12, 2008
  4. kiran
    Replies:
    5
    Views:
    3,560
  5. Tony Johansson
    Replies:
    3
    Views:
    16,506
    Patrice
    Jan 2, 2010
Loading...

Share This Page