Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document using -S to split arguments to /usr/bin/env #2027

Closed
jceb opened this issue May 12, 2024 · 2 comments · Fixed by #2038
Closed

Document using -S to split arguments to /usr/bin/env #2027

jceb opened this issue May 12, 2024 · 2 comments · Fixed by #2038

Comments

@jceb
Copy link

jceb commented May 12, 2024

just 1.25.2

I noticed that just doesn't split arguments properly in tasks with a shebang. Given the following Justfile:

run:
    #!/usr/bin/env bash -x
    ls -l
    echo "hello"

I'd expect that just run will print and execute the commands.

However, what I get is the following error:

↳ just run
/usr/bin/env: ‘bash -x’: No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines
error: Recipe `run` failed with exit code 127

Apparently, only the first space is used to split the command from its arguments. Additional spaces aren't recognized.

@casey
Copy link
Owner

casey commented May 12, 2024

Which OS are you using? Shebang argument splitting on unix is handled by the OS, so the specific behavior is OS-specific. You might need to add the -S flag, like so:

run:
    #!/usr/bin/env -S bash -x
    ls -l
    echo "hello"

This should probably be documented in the readme.

@casey casey changed the title Shebang argument splitting Document using -S to split arguments to /usr/bin/env May 12, 2024
@jceb
Copy link
Author

jceb commented May 12, 2024

Ah, thank you! That's a valuable hint!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants