Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

starsep
Copy link
Contributor

@starsep starsep commented Aug 26, 2024

No description provided.

@joto
Copy link
Contributor

joto commented Aug 27, 2024

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.

@starsep
Copy link
Contributor Author

starsep commented Aug 27, 2024

Note the same shebang is used in

#! /usr/bin/env bash

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.

@tomhughes
Copy link

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

@starsep
Copy link
Contributor Author

starsep commented Aug 27, 2024

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

@woodpeck
Copy link
Contributor

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

@starsep
Copy link
Contributor Author

starsep commented Aug 27, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants