From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "A. Mahendra Rajah" Newsgroups: gmane.os.tru64.managers Subject: Summary: system("lynx -dump") command in Perl Date: Wed, 05 Oct 2005 12:07:39 -0600 (CST) Message-ID: <01LTU4GA0FQI8WVYKM@Eason.cc.uregina.ca> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT X-Trace: sea.gmane.org 1128537736 12797 80.91.229.2 (5 Oct 2005 18:42:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 5 Oct 2005 18:42:16 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Wed Oct 05 20:42:04 2005 Return-path: Original-Received: from sws1.ornl.gov ([160.91.1.101]) by ciao.gmane.org with smtp (Exim 4.43) id 1ENEBW-0005vY-Uy for gotm-tru64-unix-managers@gmane.org; Wed, 05 Oct 2005 20:40:11 +0200 Original-Received: (qmail 16285 invoked by uid 49509); 5 Oct 2005 18:39:56 -0000 Original-Sender: tru64-unix-managers-owner@ornl.gov Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 16270 invoked by uid 49501); 5 Oct 2005 18:39:56 -0000 Original-Received: from 160.91.4.119 by sws1 (envelope-from , uid 49491) with qmail-scanner-1.25 (clamdscan: 0.83/743. spamassassin: 3.0.2. Clear:RC:0(160.91.4.119):SA:0(-2.4/5.0):. Processed in 0.386701 secs); 05 Oct 2005 18:39:56 -0000 X-Spam-Status: No, hits=-2.4 required=5.0 Original-Received: from emroute1.cind.ornl.gov (160.91.4.119) by sws1.ornl.gov with SMTP; 5 Oct 2005 18:39:55 -0000 Original-Received: from emroute1.cind.ornl.gov (localhost [127.0.0.1]) by emroute1.cind.ornl.gov (PMDF V6.2-1x9 #31038) with ESMTP id <0INW00JJFH6JXT@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Wed, 05 Oct 2005 14:39:55 -0400 (EDT) Original-Received: from VIRUSCAN-DAEMON.emroute1.cind.ornl.gov by emroute1.cind.ornl.gov (PMDF V6.2-1x9 #31038) id <0INW0050JH5QY9@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Wed, 05 Oct 2005 14:39:54 -0400 (EDT) Original-Received: from Eason.CC.URegina.CA (eason.cc.uregina.ca [142.3.28.142]) by emroute1.cind.ornl.gov (PMDF V6.2-1x9 #31038) with ESMTP id <0INW0040BH0FGZ@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Wed, 05 Oct 2005 14:36:16 -0400 (EDT) Original-Received: from Eason.cc.uregina.ca by Eason.cc.uregina.ca (PMDF V5.2-31 #42552) id <01LTTW2KD6OW8WVYKM@Eason.cc.uregina.ca> for tru64-unix-managers@ornl.gov; Wed, 05 Oct 2005 12:36:12 -0600 (CST) Original-To: tru64-unix-managers@ornl.gov X-Envelope-from: Mahendra.Rajah@URegina.CA X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on email.cind.ornl.gov X-Spam-Level: X-Qmail-Scanner-MOVED-X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,SPF_SOFTFAIL, UNPARSEABLE_RELAY autolearn=no version=3.1.0 Xref: news.gmane.org gmane.os.tru64.managers:8581 Archived-At: 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. ................................................................