doc/command-ref/nix-shell: Shebangs can occur anywhere (#11202)

Co-authored-by: Valentin Gagarin <valentin@gagarin.work>
This commit is contained in:
Corbin Simpson 2024-07-30 05:51:47 -07:00 committed by GitHub
parent c77b671a66
commit ee86e7f361
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -297,3 +297,8 @@ with import <nixpkgs> {};
runCommand "dummy" { buildInputs = [ python pythonPackages.prettytable ]; } ""
```
The script's file name is passed as the first argument to the interpreter specified by the `-i` flag.
Aside from the very first line, which is a directive to the operating system, the additional `#! nix-shell` lines do not need to be at the beginning of the file.
This allows wrapping them in block comments for languages where `#` does not start a comment, such as ECMAScript, Erlang, PHP, or Ruby.