Shebang directive

Under Unix-like operating systems, when a script with a shebang is run as a program, the program loader parses the rest of the script's initial line as an interpreter directive; the specified interpreter program is run instead, passing to it as an argument the path that was initially used when attempting to run the script.

Support for #! directives applies on Unix platforms only.

Usage

Add a shebang at the top of your file:

#!/usr/local/share/dotnet/dotnet

or

#!/usr/bin/env dotnet

Make file executable

After adding the shebang, make the file executable:

chmod +x cake.cs

Run directly

You can then run the file directly:

./cake.cs

Example

#!/usr/bin/env dotnet
#:sdk Cake.Sdk

Information("Hello, {0}!", "World");

See also