News for hackers. Stuff that matters.
Re:Minimal safe Bash script template by patrec on Tuesday December 15, 2020 @09:52AM (#25430795)
> The Bashism is seldom needed

I wish that were true. But posix shell lacks two fairly vital features: sane trap and process redirection. In an ideal world the posix comittee would just fix that, but I won't hold my breath.

Re:Minimal safe Bash script template by bewuethr on Tuesday December 15, 2020 @12:13PM (#25432313)
I was going through the changes introduced in Bash 5.1, and to my surprise, it mentioned[1] that process substitution is now enabled in POSIX mode. I wondered if that means POSIX sh now supports it, but I haven't been able to find evidence for that, neither in the POSIX spec nor in the bug tracker of POSIX mailing list archives.

Similarly, I remember reading about POSIX sh supporting arrays at some point in the future, but for the life of me, I can't find any evidence for this either.

[1]: https://git.savannah.gnu.org/cgit/bash.git/tree/CHANGES#n538

Re:Minimal safe Bash script template by patrec on Tuesday December 15, 2020 @12:39PM (#25432628)
Arrays in shells generally suck (and behave quite different between different shells, e.g. zsh arrays are nothing like bash arrays), so I hope they don't make it into posix. OTOH, process substitution is a perfectly elegant and nice feature that fits well into the original design of bourne shell, removing an obvious limitation of pipes. It also behaves pretty much the same across shells that have it, so it should be much easier to standardize.
Re:Minimal safe Bash script template by thomasbacklund on Tuesday December 15, 2020 @09:59AM (#25430864)
It sounds like you need Bash then :)

I totally agree Bash has some powerful features, some I go out of my way to reimplement in sh (as for example string operations [0]). But not all can ofc be replicated then bash it is.

Maybe then: sh->bash->python/perl

[0] https://gitlab.com/space-sh/string/-/blob/master/Spacefile.s...