4 ms·
Please. Use `[[ -z $var ]]` instead, and get this load of nonsense off your table. And yes, `[[ ... ]]` is a bashism. It's not going work on the HP-UX box, tha
by munchhausen 9y ago
Please. Use `[[ -z $var ]]` instead, and get this load of nonsense off your table.
And yes, `[[ ... ]]` is a bashism. It's not going work on the HP-UX box, that you do not have in your server fleet.
- fnj 9y agoIt won't work on dash or on BSD ash either. Do what you want, but you won't be doing it working for me because I care about portability.
- pyre 9y agoBetter make sure those shell scripts all run in csh/tcsh too. Never know when you'll be running on MacOS 10.1!
- stonogo 9y agocsh is still the default root shell on FreeBSD, which is in heavy use in millions of places around the world. There are also a relatively large number of tcsh users in the world. This is why, even now on latest fedora, /etc/profile.d contains csh scripts. As for sh, standards exist for a reason. Try to empathize with people who are not in your bubble.
- shakna 9y agoDash is on all my main servers, but Busybox is on the vendored stuff. That means dash & ash. Portability can matter.
- mort96 9y agothe nice thing about standards is that you don't have to make sure the script runs in a billion different shells. You just have to make sure your code is POSIX compatible, and all of a sudden, all POSIX compatible shells will interpret it just fine! Isn't that fantastic?
- comex 9y agocsh and tcsh are not POSIX compatible.
- saurik 9y agoIsn't that like arguing that one should code only in the form of polyglots that would run on any major programming language? The reality is that bash itself is both highly portable and already widely ported: in 2017 (or 2007) my bash script will run on essentially as many platforms as your POSIX shell script (including the aforementioned HP-UX: the last time I had access to one of those I definitely had access to a copy of bash; there was no reasonable JVM available!! but I definitely had bash).
- yjftsjthsd-h 9y agoNot HP-UX, but I absolutely use embedded systems (busybox) and *BSD.
- anarazel 9y ago> And yes, `[[ ... ]]` is a bashism. It's not going work on the HP-UX box, that you do not have in your server fleet. I wish. I've to take care not to break things like AIX, HP-UX, Solaris 10, Openbsd 5.1. That's an open source project, but there've been actual production customers complaining when we broke things in the past... EDIT: corrected openbsd version, machine has been updated since the last complaint