Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is /usr/bin/env bash good enough? Or should I assume that only a "sh" is available? (I found tcsh tricky when I first started using FreeBSD, and I think a few of my accounts have the default shell set to bash)


Most times yes. In practice I suspect most deployed servers have something like

ln -sf /usr/local/bin/bash /bin/bash

Infinitely more entertaining is running unzip at the command prompt results in /usr/bin/unzip which is extremely limited compared to (installed via pkg) infozip at /usr/local/bin/unzip. At least one specific example I ran into was Play/Activate Scala framework can be convinced via "dist" target to make a zip file of all the jars necessary to run a project, and you guessed it, /usr/bin/unzip doesn't understand that zipfile format and /usr/local/bin/unzip works perfectly. So you can't have a script that automatically runs unzip because you need to run /usr/local/bin/unzip specifically.

Lack of a Debian-like alternatives system is really the only systemic problem I run into on a regular basis. Then again it creates an inconsistency across multiple servers and I would not enjoy playing "update-alternatives whack a mole" to figure out which of my frontends have infozip provide unzip, and which fail.


> Lack of a Debian-like alternatives system is really the only systemic problem I run into on a regular basis.

We'll, there's always Debian/kFreeBSD for that...


Its likely easier to implement a debian-like alternatives system (by hand or by ansible with symlinks if necessary) than to turn a Debian/SystemD non-unix into something unix-like such as Freebsd. Or Freebsd is much closer to what I want, than Debian, so logically it would be easier to change a little bit of Freebsd than a whole lot of Debian.


Of course, Debian/kFreeBSD is an ambitious project - and probably not what you want if you would rather run FreeBSD -- but Debian/kFreeBSD already exists (I'm not sure of the status of Stretch and/or support for the FreeBSD 11 kernel etc):

https://www.debian.org/ports/kfreebsd-gnu/


if you actually need bash, /usr/bin/env bash works; but often something could actually be a sh script with a bit of care. Some Linux distributions have been changing /bin/sh to something other than bash, which helps.

if bash is installed; if not, at least it's a fairly clear indication that you should install bash




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: