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

Why does installation add a interpreter directive (shebang) to bash_profile? #2202

Open
menicosia opened this issue Mar 29, 2023 · 1 comment

Comments

@menicosia
Copy link

Hi, sorry if this an FAQ, but I was just installing bash_it on a new computer, and I noticed as it overwrite my .bash_profile that it added:

#!/usr/bin/env bash

and I kind of wondered why? I thought that the shell sources this file, I wouldn't expect it to need to be in a sub-shell, and I kind of wonder if that might introduce subtle bugs?

So, not sure if this is an issue, I don't know if it should be upgraded to a bug. What do you think?

Thanks!

@davidpfarrell
Copy link
Member

Hi @menicosia !

So this has been present forever!

In fact a lot of sourced files in our repo still have it :(

It is quasi-useful for shellcheck to know that it is a bash file, but we've shifted to using this for .bash files instead:

# shellcheck shell=bash

I would definitely treat this as a bug, and either consider removing it entirely or at the very least replacing it with the shellcheck item above.

My first preference would be to remove it entirely as the end-user doesn't really need either of them.

If you'd like to submit a quick PR to replace, that would be great :)

Either way, thanks for reporting it!

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 a pull request may close this issue.

2 participants