From e2c9405fa910ebfb334f7069903cb2b2db3a221c Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 14 May 2024 19:23:42 -0700 Subject: [PATCH] Document using `env -S` (#2038) --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4756df3..a6d8c7d 100644 --- a/README.md +++ b/README.md @@ -2135,8 +2135,17 @@ the file as executable, and executing it. The OS then parses the shebang line into a command line and invokes it, including the path to the file. For example, if a recipe starts with `#!/usr/bin/env bash`, the final command that the OS runs will be something like `/usr/bin/env bash -/tmp/PATH_TO_SAVED_RECIPE_BODY`. Keep in mind that different operating systems -split shebang lines differently. +/tmp/PATH_TO_SAVED_RECIPE_BODY`. + +Shebang line splitting is operating system dependent. When passing a command +with arguments, you may need to tell `env` to split them explicitly by using +the `-S` flag: + +```just +run: + #!/usr/bin/env -S bash -x + ls +``` Windows does not support shebang lines. On Windows, `just` splits the shebang line into a command and arguments, saves the recipe body to a file, and invokes