26 ms·
I mean, yes, but 99% of deployments are going to be bash on some flavor of Linux.
by kfajdsl 2y ago
I mean, yes, but 99% of deployments are going to be bash on some flavor of Linux.
- chasil 2y agoNo, they are not. The Debian/Ubuntu family uses the "Debian Almquist Shell" (dash) as the system shell (#!/bin/sh) for a number of reasons. It is very much not compatible with anything fancy from bash (or korn). The bash shell is available as #!/bin/bash, but that opens the door to a new set of problems (in that POSIX mode is not enabled). In the embedded realm, busybox also implements the Almquist shell, but it does throw simple bash "slang" back in (but not this does not include arrays).
- denkmoon 2y agoHow often don't you have bash on a debian/ubuntu system though? #!/bin/bash and away you go. Every workplace I've been that uses debian just goes for bash in the shebang.
- chasil 2y agoWell, there are a few things you should consider. OpenWRT is undoubtedly using busybox. I actually saw the busybox copyright on a point-of-sale terminal at Old Navy a few years ago. The embedded realm is vast, and bash is too big for it, or intolerable because of gplv3. Android uses mksh as the system shell. The more that you know of the korn dialects, the more comfortable you will be in scripting on Android. There is no native bash, as Android's userland is BSD. That realm is also vast. Finally, Debian/Ubuntu does give you /bin/bash, but if you don't understand the need for "set -o posix" then the scripts that you wrote for CentOS will fail in many interesting ways, because you are carrying the baggage of bash's first decade, before the POSIX shell standard. So yes, cutting your scripting away to pure POSIX.2 has considerable worth. It runs everywhere.