Shebang not working with runtime directive in script file
See original GitHub issueI’m trying to play around with using these scripts, and I’m attempting to allow the file to be run directly from the terminal, however whenever I use the shebang and runtime directive together, I get the following error message:
test.csx(2,1): error CS1024: Preprocessor directive expected
I’m using the following script:
#! /usr/bin/env dotnet script
#! "netcoreapp2.1"
Console.WriteLine("Hello world");
If I remove the runtime directive, using ./test.csx
works fine, and if it remove the shebang instead, then dotnet script test.csx
works fine, it’s just when both are present, dotnet script
seems to not like it. I’ve tried putting the shebang in with double quote around it, but then dotnet script
just tries to load that as a runtime, and it doesn’t seem to work out.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Shebang not working with runtime directive in script file #306
I'm trying to play around with using these scripts, and I'm attempting to allow the file to be run directly from the terminal, ......
Read more >How to Use the Shebang in Bash and Python | Linode Docs
A Shebang directive, which always begins with the sequence #! , can sometimes be found on the first line of a Bash or...
Read more >windows - Python shebang not working
The next problem is that the shebang is not implemented by the windows command shell. It works on linux shells (and linux-like shells...
Read more >Does the shebang determine the shell which runs the script?
When the shebang is present, exec() will run the executable specified after the shebang instead. Note that this means that if you invoke...
Read more >Shebang - Linux Bash Shell Scripting Tutorial Wiki
Starting a Script With #!. It is called a shebang or a "bang" line. It is nothing but the absolute path to the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We should maybe consider scaffolding the shebang on *nix. We already set up the
omnisharp.json
duringdotnet script init
so OmniSharp will be happy either way#345 is new PR for this (I messed up the branch for #341. 2 things to make shebang work:
That works even without the PR. The PR is simple to make the Dotnet script init scaffolding do that by default.