Multiline shebang: Difference between revisions

m
{{out}}
(Give a meaningful error message before exiting on error)
m ({{out}})
Line 334:
(println (cadr (file)) (opt) (opt))
(bye)</lang>
{{out}}
Output:
<pre>$ ./myScript
"myScript" "foo" "bar"</pre>
Line 350:
}</lang>
 
{{out}}
output:
({ /* 3 elements */
"/local/users/mbaehr/src/pike/multiline-shebang/multiline-shebang.pike",
Line 371:
 
print "Hello World"</lang>
{{out}}
Output:
<pre>$ ./myScript
Hello World</pre>
 
Control structures (if/for/etc.) can't be quoted, but one can use the following to embed any script:
but one can use the following to embed any script:
<lang Python>#!/bin/sh
"true" '''\'
Line 408 ⟶ 409:
 
=={{header|Ruby}}==
One can use a single-line shebang, like <code>#!/usr/bin/env ruby</code>, and use Kernel#system or `backquotes` to run any extra shell commands. A multi-line shebang is possible, but not necessary.
and use Kernel#system or `backquotes` to run any extra shell commands.
A multi-line shebang is possible, but not necessary.
 
This script works both ways: either <code>/bin/sh script.rb</code> or <code>ruby script.rb</code> would run multiple lines of shell commands, and then start Ruby.
Line 451 ⟶ 454:
=={{header|Scala}}==
 
The [http://www.scala-lang.org/files/archive/nightly/docs-master/manual/html/scala.html scala(1)] interpreter parses a header section. The scalac compiler does not.
The scalac compiler does not.
 
<lang scala>
Anonymous user