Create an executable for a program in an interpreted language: Difference between revisions

Content added Content deleted
Line 385: Line 385:
The trick to using jq in the shebang line is NOT to specify an argument for the -f option.
The trick to using jq in the shebang line is NOT to specify an argument for the -f option.


A suitable shebang line for a script that reads from stdin would be:
Assuming the jq program is on the PATH, a suitable shebang line for a script that reads from stdin would be:


<pre>
<pre>
#!/usr/bin/env jq -Mf
#!/usr/bin/env jq -f
</pre>
</pre>

Alternatively, the full pathname can be specified, e.g. /usr/local/bin/jq -f

Other jq options can also be specified.


The file with the shebang line and program must of course be made executable (e.g. by running `chmod +x FILENAME`).
The file with the shebang line and program must of course be made executable (e.g. by running `chmod +x FILENAME`).