Skip to content

Clarify shebang requirement for running C# files directly on Unix systems. #47121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2025

Conversation

shethaadit
Copy link
Contributor

@shethaadit shethaadit commented Jul 7, 2025

Summary

Clarifies that C# files need a shebang (#!) directive to be directly executable on Unix systems with ./filename.cs.

Changes:

  • Added "(shebang)" after #! for clarity
  • Modified sentence to specify "such a C# file that contains the shebang directive"
  • Added "directly" to distinguish from dotnet run

Before:

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:

After:

On any unix system, if you set the execute (+x) permission on such a C# file that contains the shebang directive, you can run the C# file directly from the command line:

This prevents beginner confusion about why ./hello.cs doesn't work without the shebang.

Fixes #47108


Internal previews

📄 File 🔗 Preview link
docs/csharp/tour-of-csharp/overview.md A tour of the C# language

@shethaadit shethaadit requested review from BillWagner and a team as code owners July 7, 2025 21:21
@dotnetrepoman dotnetrepoman bot added this to the July 2025 milestone Jul 7, 2025
@dotnet-policy-service dotnet-policy-service bot added dotnet-csharp/svc get-started/subsvc community-contribution Indicates PR is created by someone from the .NET community. labels Jul 7, 2025
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again @shethaadit

This looks great. Let's :shipit:

@BillWagner BillWagner enabled auto-merge (squash) July 8, 2025 13:57
@BillWagner BillWagner merged commit 061a5d9 into dotnet:main Jul 8, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution Indicates PR is created by someone from the .NET community. dotnet-csharp/svc get-started/subsvc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clarification needed: Running by the command ./hello-world.cs
2 participants