Document using env -S (#2038)

This commit is contained in:
Casey Rodarmor 2024-05-14 19:23:42 -07:00 committed by GitHub
parent 2d9cfa202f
commit e2c9405fa9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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