[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

ocaml scripting...



It's me again...

We can read in the Ocaml documentation  the following paragraph :

[chapter 9 -- The toplevel system (ocaml)]
«In script mode, the first line of the script is ignored if it starts
with #!. Thus, it
is theoretically possible to make the script itself executable and put
as first
line #!/usr/local/bin/ocaml, thus calling the toplevel system
automatically
when the script is run. However, ocaml itself is a #! script on most
installations of Objective Caml, and Unix kernels usually do not
handle
nested #! scripts.»

However, our first try shows that
<<theoretically>> and <<automatically>> do not have any effect
compared
to the <<usually do not handle>> one... ;-)
In other words, something like

#!/usr/bin/ocaml
print_string "foo";;

does not work ...

BUT

#!/usr/bin/ocamlrun /usr/bin/ocaml
print_string "foo";;

works...

Any comment ??
[Why <<Unix kernels usually do not handle nested #! scripts>> ...]

PS : ok, may be there is a practical reason (related to security??)
but
how do you explain such strange invocation to folks who use everyday
"#!/usr/bin/perl"
 or "#!/usr/bin/sh" ...

-- 
# Georges MARIANO                 tel: (33) 03 20 43 84 06
# INRETS, 20 rue Élisée Reclus    fax: (33) 03 20 43 83 59
# 59650 Villeneuve d'Ascq         mailto:georges.mariano@inrets.fr
# FRANCE.                         
# http://www3.inrets.fr/estas/mariano
# http://www3.inrets.fr/B-Bibliography



Reply to: