From 0a54124c3a11ec5e535e63dde575f32c622d218d Mon Sep 17 00:00:00 2001 From: typicode Date: Sat, 9 Mar 2024 11:13:39 +0100 Subject: [PATCH] docs: bash --- docs/how-to.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/how-to.md b/docs/how-to.md index df116b59..60b25f80 100644 --- a/docs/how-to.md +++ b/docs/how-to.md @@ -157,6 +157,21 @@ In order to run scripts that require the use of a scripting language, use the fo // ... ``` +## Bash + +Hook scripts need to be POSIX compliant to ensure best compatibility as not everyone has `bash` (e.g. Windows users). + +That being said, if your team doesn't use Windows, you can use Bash this way: + +```shell +# .husky/pre-commit + +bash << EOF +# Put your bash script inside +# ... +EOF +``` + ## Node Version Managers and GUIs If you're using Git hooks in GUIs with Node installed via a version manager (like `nvm`, `n`, `fnm`, `asdf`, `volta`, etc...), you might face a `command not found` error due to `PATH` environment variable issues.