[Israel.pm] system() platform dependant issue

Omer Zak omerz at actcom.co.il
Tue Sep 5 04:16:18 PDT 2006


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 to execute 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




More information about the Perl mailing list