Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Misleading use of shebang #105

Closed
h1z1 opened this issue Oct 9, 2020 · 1 comment
Closed

Misleading use of shebang #105

h1z1 opened this issue Oct 9, 2020 · 1 comment

Comments

@h1z1
Copy link

h1z1 commented Oct 9, 2020

Just a bit of forewarning with regard to the "recommended" use of shebangs.

# Right:

    #!/usr/bin/env bash

# Less right:

   #!/bin/bash

Using env by default is not a good habit because as you state above:

The former searches the user's PATH to find the bash binary.

You do not WANT bash looking at a users local path for say, system scripts, things meant to be run by root or any other user. To say the latter is bad, is.. well, bad itself.

PATH can be manipulated, a script can be set readonly.

Took an inordinate amount of time to explain this to a junior sysadmin who was adamant every script on a production host should be changed "because".

@dylanaraps
Copy link
Owner

See: #82

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

No branches or pull requests

2 participants