Description
Type of issue
Missing information
Description
In the File based programs section, it says -
On any unix system, if you set the execute (
+x
) permission on a C# file, you can run the C# file from the command line:./hello-world.cs
I think this statement needs some modification/clarification.
Consider a C# file, named hello.cs
, having the following code:
Console.WriteLine("Hello, World!");
I'm new to learning C# and .NET, but my doubt is how can this hello.cs
program run by the command ./hello.cs
when there is no shebang (#!
) interpreter directive?
If the above quoted statement is actually correct, I think, for a beginner like me, it needs some explanation for how it actually works (without having the shebang (#!
) interpreter directive in the C# source file). Or else if this statement is incorrect, it needs modification something like this:
On any unix system, if you set the execute (
+x
) permission on a C# file that has the shebang interpreter directive ->#!/usr/bin/dotnet run
in the beginning of the file, you can run the C# file from the command line:./hello-world.cs
Page URL
https://learn.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/overview#code-try-1
Content source URL
https://github.com/dotnet/docs/blob/main/docs/csharp/tour-of-csharp/overview.md
Document Version Independent Id
ffae9ae1-d3f5-4192-0a18-ca475c712813
Platform Id
41a669fb-55ed-d212-8af3-4d212ac707a2
Article author
Metadata
- ID: 85b00578-37d2-1fd1-911d-3097aa73f212
- PlatformId: 41a669fb-55ed-d212-8af3-4d212ac707a2
- Service: dotnet-csharp
- Sub-service: get-started