Hacker News new | ask | show | jobs
by ilikejam 1328 days ago
2. Why should bash be in /usr/bin? Mine's in /usr/local/bin and I've seen vendored bash binaries in very weird places. Respect the user's PATH.

8. '[' and '[[' are both bash builtins.

9/15. If you're using shellcheck, you'll need to quote (almost) all vars anyway.

2 comments

> 2. Why should bash be in /usr/bin? Mine's in /usr/local/bin and I've seen vendored bash binaries in very weird places. Respect the user's PATH.

Yup, nix and guix consistently put their binaries in "very weird places" - unless you want to make users of those tools unhappy (among others!) please use env. The user knows where their shell is more than you do.

> 8. '[' and '[[' are both bash builtins.

'[' is a builtin, '[[' is a keyword. Can use bash's builtin 'type' to check.