I'm using dotnet-script
for the first time, I'm getting some undesirable behavior I don't know how to fix.
My script expects a "-v" argument, but instead of that getting passed through, dotnet-script swallows it and prints out its own version number. This happens for the most basic of scripts:
#!/usr/bin/env dotnet-script
Console.WriteLine($"Hello World:\n{string.Join('\n', Args)}");
Example input/output:
> ./script.csx "hi again"
Hello World:
hi again
> ./script.csx "hi again" -v
1.4.0
How can I avoid dotnet-script
swallowing arguments?
I know I could avoid using the -v argument in my script, but I'd like to avoid this behavior entirely so I don't come across other swallowed arguments.
I've never used
dotnet-script
before, but after a quick search I found this source which states:So it sounds to me like perhaps you just need to add
--
before the arguments that you want passed to your script: