Missing expression after unary operator ‘–‘

Question:

This is my first post so apologies for any mistakes.

I ran the dotnet command in the Windows Powershell and It gave me a description of how to use it:

When I ran the command

It gave me the following error:

Any ideas why this is happening? Why is the command not showing help as intended? Having searched everywhere, I haven’t been able to get a conclusive answer.

Answer:

-v|--verbose means you can use either -v or --verbose ; the | in this context is BNF‘s ‘or’ symbol.

Many options come in short form with a single (or few) letters mnemonic, or in long form which is more descriptive of the option. The short form will start with a single dash, while the long form starts with two dashes.

| in the context of powershell is a pipe, which separates commands, and the errors you see is the interpreter trying to make sense of --help as a command : it understands -- as the unary minus, but can’t make sense of help in that context.

You probably want to use dotnet run -h.

Source:

Missing expression after unary operator ‘–‘ by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply