-
Notifications
You must be signed in to change notification settings - Fork 503
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
Multi-line script without shebang? #2192
Comments
Try removing |
I'm not sure which Using the script:
I get:
If I switch the Justfile shell line to remove the
I get:
|
Currently, I don't think there's a good workaround for this. Shebang paths must be absolute, so there's no way to get them working on Windows and Unix without hackery. I think the best solution would be implementing #1479, this would allow you to write: [script("nu", "-c")]
foo:
let var = "World"
print $"Hello ($var)"
The I'm a bit unsure about the name of the annotation. In current parlance, recipes are called either "shebang" recipes or "linewise" recipes, but |
Would it be easier to go the other way and support a flag |
I'm not sure that would make a ton of sense, since if |
The default interpreter |
The Se the |
I assumed when I specified the |
Ah, gotcha. It generally isn't possible to reuse an interpreter after the process returns. And just concatenating all the lines and running them may be possible, but might run into some argument length limit. |
I had to spend some time reading the code to fully understand what was happening. The The Really what I'm after is the running essentially the same as Which is why you earlier indicated that So maybe a |
Something like this might work.
|
I currently use the shell initialization
Which is able to resolve my nu shell location in my
PATH
fine.If I try the same thing in a recipe with a shebang it unable to locate.
I know I could place the absolute path or the use
/usr/bin/env
to locate, but a large reason for usingnu
was to keep my scripts as platform neutral as possible. If I place/usr/bin/env
that makes Windows more difficult.I like the fact that
set shell
is able to locate nu via thePATH
which works great for single line recipes. Currently, I'm either having to escape my line endings with\
to simulate a single line command, or shell out to another nu script which breaks recipes up to avoid having to backslash.I'd like some way to run a multi-line recipe without the shebang and use the configured shell.
Thanks!
The text was updated successfully, but these errors were encountered: