Bash-it / bash-it

A community Bash framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

menicosia opened this issue · comments

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!

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!