google / google/zx

Allow multiple lines of hashbangs

Open
#715 5 comments 0 reactions 0 assignees View on GitHub
docs needed
Dominant language
JavaScript
Stars
45.7k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

## Expected Behavior
Nix allows the use of shebang to define a [custom interpreter](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix.html?highlight=shebang#shebang-interpreter), for example:

```
#! /usr/bin/env nix-shell
#! nix-shell -i zx -p zx

await $`echo 1`
```

zx should ignore multiple shebang lines instead only the first one.

## Actual Behavior

`SyntaxError: Invalid or unexpected token`

## Steps to Reproduce the Problem

0. (setup) Install nix
1. Add the above shebang lines to the start of the script (script.mjs)
2. Try to run the script with `zx script.mjs`

## Specifications

- Version: 7.1.1
- Platform: macOS

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.