-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comment continuation needed on first comment following shebang #1044
Comments
nicowilliams
added a commit
to nicowilliams/jq
that referenced
this issue
Dec 15, 2015
Allow a continuation on a comment immediately after a shebang to make this traditional hack possible: #!/bin/sh # this next line is ignored by jq \ exec jq -f "$0" "$@" # jq code follows But continue only on the first line following a shebang, and only if it's a comment.
The FAQ now documents the |
Thanks @pkoppstein. |
mark-kubacki
pushed a commit
to mark-kubacki/jq
that referenced
this issue
Aug 19, 2016
Allow a continuation on a comment immediately after a shebang to make this traditional hack possible: #!/bin/sh # this next line is ignored by jq \ exec jq -f "$0" "$@" # jq code follows But continue only on the first line following a shebang, and only if it's a comment.
](url) |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Historically shebangs allow only one argument in the shebang line. This means that if the script author doesn't know the path to the script interpreter and they need to pass any additional arguments to said interpreter, then they can't write the script.
The typical thing to do is this:
But jq does not have comment continuations now, so adding them now would break backwards compatibility. But I think it'd be safe to scan for the shebang and continued comment on the first line in
main()
(as opposed to insrc/parser.y
). Then the above would work and there chance of breakage would be astronomically small.The text was updated successfully, but these errors were encountered: