docs: bash (#1404)

This commit is contained in:
typicode
2024-03-09 11:58:34 +01:00
committed by GitHub
parent b1ba6d5c30
commit e3b520ab5d
+15
View File
@@ -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.