Multiline shebang: Difference between revisions

From Rosetta Code
Content added Content deleted
(Added Common Lisp)
 
(clarification)
Line 3: Line 3:


Occasionally, a more complex shebang line is needed. For example, some languages do not include the program name in ARGV; a multiline shebang can reorder the arguments so that the program name is included in ARGV.
Occasionally, a more complex shebang line is needed. For example, some languages do not include the program name in ARGV; a multiline shebang can reorder the arguments so that the program name is included in ARGV.

The syntax for a multiline shebang is complicated. You need to simultaneously comment the shebangs away from the language and reveal them uncommented to Bash so that the shebangs can be executed.


=={{Common Lisp}}==
=={{Common Lisp}}==

Revision as of 05:11, 6 August 2011

Multiline shebang is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Simple shebangs can help with scripting, e.g. #!/usr/bin/env python at the top of a Python script will allow it to be run in a terminal as "./script.py".

Occasionally, a more complex shebang line is needed. For example, some languages do not include the program name in ARGV; a multiline shebang can reorder the arguments so that the program name is included in ARGV.

The syntax for a multiline shebang is complicated. You need to simultaneously comment the shebangs away from the language and reveal them uncommented to Bash so that the shebangs can be executed.

Template:Common Lisp

Here, the script name is passed once to CLISP and once to ext:*args*, which normally omits it.

<lang lisp>#!/bin/bash

  1. |

exec clisp -q -q $0 $0 ${1+"$@"} exit |#</lang>