Native shebang: Difference between revisions

(Added Go)
(→‎{{header|OCaml}}: added ocaml)
Line 615:
<lang sh>$ ./echo.foo --arg x "Hello, world!"
Hello, world!</lang>
 
 
=={{header|OCaml}}==
OCaml can run in script mode or compiled (compiled to bytecode or native binary).
 
'''File: echo.ml'''
<lang ocaml>#! /usr/bin/env ocaml
 
let () =
let argl = Array.to_list Sys.argv in
print_endline (String.concat " " (List.tl argl))</lang>
{{out}}
<pre>
$ chmod u+x echo.ml
$ ./echo.ml Hello, world!
Hello, world!
</pre>
But we have to remove the shebang if we want to compile the code:
<pre>
$ ocamlc -c echo.ml
File "echo.ml", line 1, characters 0-2:
Error: Syntax error
</pre>
 
 
=={{header|Perl}}==
Line 632 ⟶ 656:
Hello, world!
</pre>
 
=={{header|Perl 6}}==
Perl 6 is not installed by default on most systems and does not have a default install directory, so the path will vary by system.