3 ms·
Most of the pitfalls described in this doc are /bin/sh pitfalls, not bash per-se. On that note, let me rant: stop writing bash scripts people. If POSIX shell i
by simias 6y ago
Most of the pitfalls described in this doc are /bin/sh pitfalls, not bash per-se.
On that note, let me rant: stop writing bash scripts people. If POSIX shell is not good enough, it's a good sign that you should move to a more expressive language with better error handling. Bash is a crappy compromise: it's not as portable as POSIX but it's also a very crappy scripting language.
You might say I'm a pedant because "bash is everywhere nowadays anyway, your /bin/sh might even be bash in disguise" but I'll be the one having the last laugh the day you have to script something in some busybox or bash-less BSD environment. Knowing how to write portable shell scripts is a skill I value a lot personally, but that might be because I work a lot with embedded systems.
Also if you assume that your target system will always have bash, there's a very good chance that it'll also have perl and/or python too. So no excuses.
- scipute68 6y agoThis is basic nonsense. Design your scripts and provision your environments. _You_ can stop writing bash scripts. I find them eminently useful and I control/provision the environments they run in. If you are not in control then do what you are told. Most people would puke if I told them that a lot of csh is alive and well in sci-prod environments but that is the way it are. You _do_ tailor your environment bc that is the way *nix was designed. Controlling people and peoples habits is faang land.