Can I use Bash interpreter in service/daemon scripts?

Édouard Lopez asked:

I’m writing a Debian/Ubuntu service that should start on at runlevel 2-5.

Most of the existing services I came accross are written using /bin/sh (Shell) interpreter while /bin/bash (Bash) offer lot of improvement and simplification.

So is there good reasons to avoid the use of bash, when targets are limited to debian 6+ and ubuntu 12.04 ?


I usually add the following shebang to my scripts: #!/usr/bin/env bash

My answer:

Bash might not be installed.

Unlike other distributions, Debian and Ubuntu use dash, a stripped down Bourne shell, as the default /bin/sh shell.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.