Re: [PATCH] scripts: dev-needs.sh: Enforce bash usage

From: Saravana Kannan
Date: Tue Jan 24 2023 - 21:26:19 EST


On Mon, Nov 14, 2022 at 2:30 AM David Laight <David.Laight@xxxxxxxxxx> wrote:
>
> From: Steffen Kothe
> > Sent: 12 November 2022 09:41
> ...
> > What about a re-write of the script in POSIX compliant style? This
> > should work then in every shell derivate without weird checks.
> >
> > This would remove for example function declarations, arrays and so on,
> > targeting to the same printable output but with different logic in the
> > background.
>
> A quick read:
>
> - remove the word 'function'.
> - remove all 'local', ensure names are unique.
> - use 'printf '%s' "....." instead of echo -n.
>
> That should be pretty near portable.
> Some shells that don't object to the 'local' keyword don't
> actually implement local variables!
>

Steffen/David,

I'll happily test and take any updates that's at least as readable as
what's there now, as long as it continues working with toybox.

-Saravana