logoalt Hacker News

denkmoon11/21/20241 replyview on HN

How 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.


Replies

chasil11/21/2024

Well, 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.