Subject: Re: ksh vs. pd-ksh and bash
To: Louis Guillaume <lguillaume@berklee.edu>
From: matthew sporleder <msporleder@gmail.com>
List: netbsd-users
Date: 03/10/2007 09:59:09
On 3/10/07, Louis Guillaume <lguillaume@berklee.edu> wrote:
> Christos Zoulas wrote:
> > In article <45F1D674.9080306@berklee.edu>,
> > Louis Guillaume  <lguillaume@berklee.edu> wrote:
> >> Hi,
> >>
> >> I'm trying to figure out a shell problem so that the script is portable.
> >>
> >> bash and pdksh seem to behave the same, but I think they're wrong. They
> >> seem to run the `while' segment of the pipeline in a subshell. Or something.
> >>
> >> ksh88 does the right thing.
> >>
> >> Is there some good reason for bash's and pdksh's misbehaviour??
> >>
> >> Louis
> >
> > According to the standards the shell is allowed to execute the loop
> > in a subshell. Dependiing on it to be executed in the same shell is
> > non-portable.
> >
> > christos
> >
>
> Ok. That's a real bummer. Is there a better way?
>

Use awk, which is relatively easy to keep portable even between gawk,
real awk, and other awks.  Even better- use a language like perl or C,
where you can be even more portable without worrying about the
platform very much.