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 env bash to make script more portable #7

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

Conversation

Sighery
Copy link

@Sighery Sighery commented Jul 13, 2023

Some systems might not have the /bin/bash link, they might just have a /bin/sh that detects whether to run sh or bash automatically. One example of this is NixOS, or the BSDs.

Instead you can rely on the env utility to figure out where bash is, using the user's PATH. env will look into all the available paths and use the first path that matches the binary you're looking for, which should make this script more portable.

Some systems might not have the `/bin/bash` link, they might just have
a `/bin/sh` that detects whether to run `sh` or `bash` automatically.
One example of this is NixOS, or the BSDs.

Instead you can rely on the `env` utility to figure out where `bash`
is, using the user's `PATH`. `env` will look into all the available
paths and use the first path that matches the binary you're looking
for, which should make this script more portable.
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.

1 participant