If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
Announcement
Collapse
No announcement yet.
GNU Bash 5.1 Released With New "SRANDOM" Variable As A New Means Of Randomness
Shell scripts should be written in POSIX sh, unless there's a reason not to. bash and zsh mostly add interactive features. Even arrays seem to be coming to sh in the next POSIX spec.
Also, there's nothing "modern" about bash (not that "modern" actually means anything these days).
I do not hate myself enough to write pure POSIX shell scripts. My scripts are written with all bashisms I need to get the job done in a reasonable fashion and are expected to be executed in bash by the end user.
Its my main programming language after all, so I write a lot of lines of bash per month.
Anyone who is having difficulties compiling bash-5.1 because of a seemingly missing include file "builtext.h" try compiling it without parallelisation (i.e. make -j1). There is evidently a dependency missing and causing the build to randomly fail.
I do not hate myself enough to write pure POSIX shell scripts. My scripts are written with all bashisms I need to get the job done in a reasonable fashion and are expected to be executed in bash by the end user.
Its my main programming language after all, so I write a lot of lines of bash per month.
I used to be a POSIX/sh defender, especially in regards to OS scripts, but at some point it's like saying I'm not going to use Python because it might not be installed on someone's PC or some Python person saying I'm not gonna use Pip because someone might not have the internet available.
So now I use Zsh and Bash isms and I don't care about maintaining compat with sh. #!/bin/not-sh ain't that hard to figure out
Shell scripts should be written in POSIX sh, unless there's a reason not to...
... and there is plenty of reason not to!
What you want to say is that one should use a better shell than what the basic standard has to offer when possible. One finds bash on almost every and even the most basic Linux installations. There is plenty of goodness in bash worth using. From associative arrays, arithmetic expressions, extended variable substitutions and lots more.
I would sooner force a user to install bash before I give up on these features, because giving up on these when you need them means you'll have to implement these through other means such as command pipes where you end up wasting lots of CPU cycles, create dependencies on external commands (i.e. expr, sed, basename, etc.), and will have to rely on their standard conformance, too.
POSIX sh is a standard for creating backwards compatibility. Only use it when you need this compatibility more than anything else. Most distribution, i.e. Debian-based ones, use a mix of bash and sh scripts for the system and you can rely on finding a /bin/bash installed.
And when bash isn't enough then don't hesitate to use perl or python or something else. Don't go backwards, but use the better tools that are out there.
Take a deep breath, stay calm, then read your own comment again and then try to read and comprehend the comments of others in their entirety.
Right now are you obsessed, suffer a superiority complex and write comments like a child who is counting with its fingers, and I cannot imagine that you would want to be taken serious.
or some Python person saying I'm not gonna use Pip because someone might not have the internet available.
The more likely scenario is that Corporate firewall / policy will prohibit it. Ultimately, I actually agree with this, it is probably a good thing... I just get to re-implement whatever it is.
The more likely scenario is that Corporate firewall / policy will prohibit it. Ultimately, I actually agree with this, it is probably a good thing... I just get to re-implement whatever it is.
I used example that because a lot of what Pip provides is in distribution repositories because of the corporate firewalls, Python being used in system tools, and whatnot. I just think limiting yourself to the bare minimum of something because someone might have to resolve dependencies becomes a little lame at some point...especially with Pip where you end up doing redundant work just to reimplement the wheel. But if someone is dumb enough to pay for that...cool...sounds like you have a sweet gig.
Comment