[Israel.pm] system() platform dependant issue

guy keren choo at actcom.co.il
Tue Sep 5 09:57:36 PDT 2006


On Tue, 5 Sep 2006, Levenglick Dov-RM07994 wrote:

> I tried modifying $ENV{SHELL}, but it didn't help. Doesn't Perl call the
> shell specified in %ENV?


dave, don't do that....

use the bourne shell syntax:

cmd > filename 2>&1

this should work on both systems (and others).

--guy

>
>
>
> Best Regards,
> Dov Levenglick
> DSP SoC System and Applications Engineer,
> Network and Computing Systems Group
> Freescale Semiconductor Israel
> Tel. +972-9-952-2804
> The information contained in this email is classified as:
> [x] Freescale General Business Information
> [ ] Freescale Internal Use Only
> [ ] Freescale Confidential Proprietary
> [ ] Personal Memorandum
>
> -----Original Message-----
> From:perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
> Behalf Of Omer Zak
> Sent: Tuesday, September 05, 2006 14:16
> To: Perl in Israel
> Subject: Re: [Israel.pm] system() platform dependant issue
>
> The reason is that under Solaris, your perl system() invokes the system
> shell (/usr/bin/sh) and gets it to execute the command.
> sh does not recognize the >& construct (I confirmed this by running sh
> interactively and typing the command to it).
>
> Apparently, in Linux perl uses a more modern shell toexecute the
> system()
> call.
>                                             --- Omer
>
> On Tue, 5 Sep 2006, Levenglick Dov-RM07994 wrote:
>
> > Hi,
> > This runs very nicely on Linux but returns "sh: /dev/null: bad number"
> > on Solaris. Can anyone explain?
> > Can anyone give me a robust solution that will run on all shells on
> all
> > platforms?
> >
> > #!/usr/local/bin/perl
> >
> > $cmd = 'echo blaaaa >& /dev/null';
> > system("$cmd");
>
> My opinions, as expressed in this E-mail message, are mine alone.
> They do not represent the official policy of any organization with which
> I may be affiliated in any way.
> WARNING TO SPAMMERS:at http://www.zak.co.il/spamwarning.html
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
>

-- 
guy

"For world domination - press 1,
 or dial 0, and please hold, for the creator." -- nob o. dy




More information about the Perl mailing list