On NixOS, shells like sh and bash aren't found in /bin; rather, they're stored elsewhere and found in the system environment. Because of this, #!/bin/bash will fail to find the bash shell on NixOS systems.
On the contrary, #!/usr/bin/env sh is compatible with all Linux systems.
On NixOS, shells like
sh
andbash
aren't found in/bin
; rather, they're stored elsewhere and found in the system environment. Because of this,#!/bin/bash
will fail to find the bash shell on NixOS systems.On the contrary,
#!/usr/bin/env sh
is compatible with all Linux systems.