Hey lets talk a little about the shebang at the top of a bash file.
Did you know there are different types?
Did you know those types could affect the security of your script?
There are two different types of shebangs for bash they are as follows:
## Direct link examples. There are multiple because it may be done differently in different Linux distros.
## Direct bash call shebang.
## Shebang of a distro with symlinked /bin -> /usr/bin, /sbin -> /usr/sbin, etc.
## Arch fits in this category.
## Non Symlinked distro such as ubuntu or debian.
Doing your shebang the above way is not the best way in most cases.
Doing your shebang this way creates the best portability
within your system.
Now I mentioned security but I didnt really mention why these two had differences in security, Here it is!
If I check the man page for env or run whatis env I get something similar to this. Whatis listed more but this was the listing that I made most sense and corresponds with the man page.
env - run a program in a modified environment
The info I am about to put in here is available via the env man page or env --help:
$ env --help
Usage: env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]
Set each NAME to VALUE in the environment and run COMMAND.
Since we sent no NAME=VALUE fields when we run the shebang this should start our script with a clean environment.