From 872c5847962bcdc160271fd1760bac6e5ffc4c38 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Wed, 3 Apr 2024 16:38:32 +0200 Subject: [PATCH] docs: Add troubleshooting entry on missing /bin/bash on Nix Co-authored-by: Peter Braden --- .../troubleshooting.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md index cf18e91e5eb..62232b1afcb 100644 --- a/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md +++ b/assets/chezmoi.io/docs/user-guide/frequently-asked-questions/troubleshooting.md @@ -253,7 +253,7 @@ $ chezmoi $COMMAND | tee $FILENAME >/dev/null # succeeds Secondly, you can install chezmoi with any of the [many supported install methods](../../install.md) instead of snap. -## chezmoi reports `fork/exec ...: no such file or directory` when running scripts on Termux +## chezmoi reports `fork/exec ...: no such file or directory` when running scripts on Nix or Termux You are likely using a hardcoded script interpreter in the shebang line of your scripts, e.g. @@ -262,10 +262,24 @@ scripts, e.g. #!/bin/bash ``` -`/bin/bash` does not exist on Termux. You must update the shebang line to point +`/bin/bash` does not exist on Nix or Termux. You must update the shebang line to point to the actual bash interpreter. The easiest way to do this is make the script a template and use the `lookPath` template function, for example: ``` #!{{ lookPath "bash" }} ``` + +Alternatively, you can use the actual path to `bash` on your system, for example: + +=== "Nix" + + ```bash + #!/usr/bin/env bash + ``` + +=== "Termux" + + ```bash + #!/data/data/com.termux/files/usr/bin/bash + ```