I wrote a .net core command line app and I wanted to easily be able to run it from the command line on multiple platforms. For Windows I wrote a cmd file. For Linux and MacOs I wrote a bash script.
.net core apps compile to a DLL. To run them from the command line you enter:
dotnet myApp.dll <my command line args>
My bash script looks like:
#!/bin/sh
dotnet ./myApp.dll "$@"
rc=$?
exit $rc
When I run my app through the shell script I get the following error: ' is not recognized.
But if I skip the shell script, and run the app directly as dotnet myapp.dll I get no error whether running on Windows or Linux.
I believe the error is being generated by the library I'm using for command line parsing, but I suspect the problem may be in my bash script. This is the library that I'm using for Command line parsing. https://github.com/commandlineparser/commandline
If I add echo "$@" to the top of the script, I see my command line argument echoed to the console.
Is there an error in my bash script? Is there a better way to write this script?
There could be multiple command line arguments and I want to pass them all to my application as if I had run the app directly using the dotnet cli.