tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: "A. Mahendra Rajah" <Mahendra.Rajah@URegina.CA>
Subject: Summary: system("lynx -dump") command in Perl
Date: Wed, 05 Oct 2005 12:07:39 -0600 (CST)	[thread overview]
Message-ID: <01LTU4GA0FQI8WVYKM@Eason.cc.uregina.ca> (raw)

  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.       
................................................................



                 reply	other threads:[~2005-10-05 18:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox