Summary: system("lynx -dump") command in Perl

From: A. Mahendra Rajah (Mahendra.Rajah_at_URegina.CA)
Date: 10/05/05

  • Next message: Denver Shepard: "Need people with time ASAP unique"
    Date: Wed, 05 Oct 2005 12:07:39 -0600 (CST)
    To: tru64-unix-managers@ornl.gov
    
    

      I asked why the following Perl statements would not produce
      the text file as desired using lynx:

      @Cmd = ($LYNX, "-cfg=$LYNX_CFG", "-dump ./$HTMLfile >| $TXTfile");
      $Stat = system(@Cmd);

      My thanks to these folks for taking the time to reply:
            Charles Ballowe
            "J.A. Gutierrez"
            Dr. Tim Cutts
            "Farmer, John"

      The following email from Dr Tim Cutts gives the complete answer
      to my problem:

    ...................................................................

      $Cmd = "$LYNX -cfg=$LYNX_CFG -dump ./$HTMLfile > $TXTfile";
      $Stat = system($Cmd);

      Would work. >| doesn't mean anything in bourne shell syntax,
      which is what system() uses. Secondly, you can't use shell
      metacharacters if the arguments to system() are a list, because
      in list form, it just calls exec(2), and no intervening shell,
      so what would happen in your code is that lynx would be called
      with two arguments

      '-cfg=something'

      and

      '-dump ./something_else >| something_again'

      Which it probably doesn't understand. See the perlfunc manpage
      entry for system, and also look at the manpage for the exec(3)
      C-library function, which will help you understand when an
      intervening shell is used and when it isn't.
    ...................................................................

      Thanks again for everyone who answered.

      -- mahendra
    ................................................................
      A. Mahendra Rajah Email: Mahendra.Rajah@URegina.CA
      Tru64 UNIX Systems Manager Phone: (306) 585-4496
      Dept. of Computing Services FAX: (306) 337-2324
      University of Regina,
      Regina, Sask., S4S 0A2
      Canada.
    ................................................................


  • Next message: Denver Shepard: "Need people with time ASAP unique"