shortbread-tilemaker icon indicating copy to clipboard operation
shortbread-tilemaker copied to clipboard

Use /usr/bin/env bash instead of bash directly

Open starsep opened this issue 1 year ago • 6 comments

starsep avatar Aug 26 '24 19:08 starsep

I am not a fan of that. Who know what bash will be in the PATH? Any extra step makes is one extra thing that can go wrong. But I don't feel strongly about that.

joto avatar Aug 27 '24 07:08 joto

Note the same shebang is used in https://github.com/shortbread-tiles/shortbread-tilemaker/blob/fb789064f307c6f0ddab84e8891748def080393b/build_test_dataset.sh#L1

I run the script on Linux distro which doesn't have bash in /bin/bash hence the PR.

It's possible that /bin/bash could be better (newer version for example) than bash from PATH but that depends on OS/user configuration.

starsep avatar Aug 27 '24 08:08 starsep

What linux distro doesn't have it? Distros which have merged /bin and /usr/bin usually have a symlink from one to the other?

tomhughes avatar Aug 27 '24 08:08 tomhughes

I used NixOS where there is no /bin/bash and no /usr/bin/bash Current version of bash is at /nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash (path changes when there is a bash update). Which is linked at /run/current-system/sw/bin/bash and /run/current-system/sw/bin is in $PATH

starsep avatar Aug 27 '24 15:08 starsep

Perhaps we can use /bin/sh instead. That surely should be where it belongs even on Nixos?

woodpeck avatar Aug 27 '24 18:08 woodpeck

Perhaps we can use /bin/sh instead. That surely should be where it belongs even on Nixos?

Indeed, there is /bin/sh which links to bash. But in general that can be a different shell. If any bash-specific features are needed then I would suggest to use AFAIK the most portable way which is proposed in this PR

starsep avatar Aug 27 '24 19:08 starsep