deno.land / x / manual@v1.28.2 / examples / hashbang.md
Making Deno scripts executable can be useful if you want to make, for example, small tools.
In this program we give the context permission to access the environment variables and print the Deno installation path.
#!/usr/bin/env -S deno run --allow-env
/**
* shebang.ts
*/
const path = Deno.env.get("DENO_INSTALL");
console.log("Deno Install Path:", path);
You may require to give the script execution permissions.
sudo chmod +x shebang.ts
Start the script by calling it like any other command:
./shebang.ts
A shebang has to be placed in the first line.
-S
splits the command into arguments.
Version Info