Make nixOS coworkers happy

| cat: Tech | tags: nixos

I learnt the other day that using #!/bin/bash as the shebang for scripts does not play nice with a friendly co-worker that uses nixOS.

From that point on I use #!/usr/bin/env bash so shell script also work on his machine.

Why does this work though?

The /usr/bin/env command will use the user env to execute bash. This means that a shell binary that is in another location but present on the $PATH will be used.

I used this before while sidestepping the python standard packaging problem. I almost never have gone too far from debian based distros, so the bash binary not being in at /bin was not a problem for me.

Different perspectives (in this case, linux distros hehe) highlight different problems. To bad that I'm stuck with my own perspective only...