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

From: David Laight
Date: Mon Nov 14 2022 - 05:31:23 EST


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!

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)