[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash exorcism experiment ('bug' 762923 & 763012)

2014-09-29 09:22:58 +1000, Russell Stuart:
> On Sun, 2014-09-28 at 16:47 +0200, Guillem Jover wrote:
> > > I've attempted to port the many shell scripts I've written over the
> > > years to dash.  The three irritants are:
> > > 
> > >   - pipefail,
> > 
> > <http://cfajohnson.com/shell/cus-faq-2.html#Q11>.
> That's one of those "scratch my eyes out" solutions. A more readable
> solution is just to say the exit status of each command in a temporary
> file.  Given how infrequently the problem arises, it isn't a major
> issue.

I happen to have written that portion of the cus FAQ. There were
a few issues with that implementation. You can find an improved
version at http://unix.stackexchange.com/a/76171/22565

> No workaround for this one?  Pity.  This is what usually prevents
> conversion.

If you do find yourself needing arrays in shells, chances are
you're not doing it the right way or that shells are not what
you need.

You may want to consider perl/ruby/python/awk instead.
Imperative programming patterns don't really apply to shells.

In any case, IMO, ksh/bash arrays are not the solution, and
there's a good reason they were never standardized by POSIX.

POSIX shells have "$@" which in most cases is more than enough.


Reply to: