3 ms·
If POSIX shell isn't good enough, you should be using a proper programming language. Encouraging this sort of thing is harmful.
by Sir_Cmpwn 8y ago
If POSIX shell isn't good enough, you should be using a proper programming language. Encouraging this sort of thing is harmful.
- athorax 8y agoCould you clarify? Unless the systems you are using require POSIX compatibility, why limit yourself? I would agree that using a proper programming language for anything more than fairly basic scripts would be a better option, but I don't necessarily see the harm.
- Sir_Cmpwn 8y agoWell, for one, limiting yourslef is a good exercise in restraint. POSIX shell is simpler than the approach shown here. Using a simpler approach keeps your code more readable and understandable, and using POSIX shell as a baseline means a wide variety of people can understand what your code is trying to accomplish. And you never know, you may someday find out that you want to move to an OS which doesn't support bash, or you start to distribute your software and the complaints roll in from the BSD users trying to port it to their OS, or bash makes some backwards-incompatible changes to some arcane behaviors this tool relies on, and since bash isn't standardized you didn't know until it was too late. I wrote a blog post about this, if you want to read more: https://drewdevault.com/2018/02/05/Introduction-to-POSIX-shell.html https://drewdevault.com/2018/02/05/Introduction-to-POSIX-she...
- _jal 8y agoAgree that accepting the POSIX limitations is healthy if doing so works for the project; disagree with the prescriptive tone. There are lots of things people "should" do, and lots of reasons why they don't; sometimes, they're good ones. So how's this for a "should"? Prescriptive advisors should be very cognizant of the dangers caused by people following such advice without understanding why they are doing so. (Hint: the people who need such advice usually don't understand it.) Additionally, such advisors should accept responsibility when those they give advice to do really weird things while trying to follow it.