[Intel-gfx] [RFC i-g-t] Deciding on #!/bin/bash or #!/bin/sh

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Fri Oct 9 07:59:45 PDT 2015


On 09/10/15 15:04, Joonas Lahtinen wrote:
> Currently the shell scripts (+ a couple of 'execl') in intel-gpu-tools
> are are using a mix of #!/bin/bash (13) or #!/bin/sh shebangs (6). Also
> 5 of the #!/bin/bash scripts do source a #!/bin/sh script.
>
> I think we should have it unified, either drop Bash dependency
> completely or convert all scripts (and execl) to use it.
>
> Most of the scripts are not using any features at all that they would
> require a #!/bin/bash shebang or could not be trivially converted to be
> #!/bin/sh compliant. Most have actually been written with #!/bin/bash
> shebang but still with constructs like 'if [ "x${FOO}" = "x" ]' which
> basically are used for compatability with ancient shells. Explained at
> http://stackoverflow.com/a/6853353 .
>
> I'd say the bash shebang is there just because author wrote it by
> habit.
>
> In favor of #!/bin/bash there is the point made by Damien (CC'd) that
> it'll rule out the incoming bug reports that are due to alternative
> shell environments.
>
> In favor of #!/bin/sh NetBSD people (CC'd) informed they'll be glad to
> see bash requirement go.
>
> How about Android, does it make a difference there?
>
> My view on this is that converting everything to #!/bin/sh allows using
> BusyBox shell which makes the minimal testing build less complex. So
> I'm in favor of converting to #!/bin/sh.

I'll just mention "#!/usr/bin/env sh" as potentially more portable 
option, for even more confusion.  :)

Regards,

Tvrtko


More information about the Intel-gfx mailing list