Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shlevy/long-shebang
A tool for #! scripts with more than one argument
https://github.com/shlevy/long-shebang
Last synced: 16 days ago
JSON representation
A tool for #! scripts with more than one argument
- Host: GitHub
- URL: https://github.com/shlevy/long-shebang
- Owner: shlevy
- License: mit
- Created: 2016-07-31T16:09:45.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-23T23:22:59.000Z (over 7 years ago)
- Last Synced: 2024-10-11T23:45:59.990Z (about 1 month ago)
- Language: C
- Size: 6.84 KB
- Stars: 41
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
long-shebang
=============A tool for `#!` scripts with more than one argument.
On [most][1] modern systems, the kernel will only pass one argument to
a shebang interpreter script. Some tools, like `perl` and `ruby`, work
around this by parsing the shebang line themselves. `long-shebang` is a
more general solution: it will parse the *second* line as a shebang
line, with arbitrary numbers of arguments. As an additional convenience,
the program to be run can be looked up in `PATH`.Usage
------```
#!/usr/bin/env long-shebang
#!sh -e
false
true
```will fail with exit code 1
Escapes
--------The following escapes are recognized in the second `#!` line:
* `\\`: A literal `\`
* `\n`: A newline
* `\ `(backslash-space): A space rather than an argument delimiter
* `\a`: If this is the first argument on the second `#!` line,
don't treat the program name as `argv[0]`. For example, a script
with `#!\a sh bash -e` will be equivalent to
`execvp("sh", {"bash", "-e", script, NULL})` rather than
`execvp("sh", {"sh", "bash", "-e", script, NULL})`.[1]: http://www.in-ulm.de/~mascheck/various/shebang/