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

From: A. Mahendra Rajah <Mahendra.Rajah_at_URegina.CA>
Date: Wed, 05 Oct 2005 12:07:39 -0600 (CST)

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

  _at_Cmd = ($LYNX, "-cfg=$LYNX_CFG", "-dump ./$HTMLfile >| $TXTfile");
  $Stat = system(_at_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_at_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.
................................................................
Received on Wed Oct 05 2005 - 18:41:29 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:45 NZDT