From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id DAA20010 for caml-redistribution; Thu, 8 Jul 1999 03:40:35 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA31081 for ; Mon, 5 Jul 1999 10:08:29 +0200 (MET DST) Received: from maxime.u-strasbg.fr (maxime.u-strasbg.fr [130.79.75.36]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id KAA00801; Mon, 5 Jul 1999 10:08:23 +0200 (MET DST) Received: (from luther@localhost) by maxime.u-strasbg.fr (8.8.7/8.8.7) id KAA03472; Mon, 5 Jul 1999 10:09:51 +0200 (MET DST) Message-ID: <19990705100950.A3414@maxime.u-strasbg.fr> Date: Mon, 5 Jul 1999 10:09:50 +0200 From: Sven LUTHER To: Pierre Weis , Markus Mottl Cc: caml-list@inria.fr Subject: Re: Sys.argv with interpreter and compiler Reply-To: luther@dpt-info.u-strasbg.fr References: <199907012235.AAA05846@miss.wu-wien.ac.at> <199907020039.CAA28037@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2 In-Reply-To: <199907020039.CAA28037@pauillac.inria.fr>; from Pierre Weis on Fri, Jul 02, 1999 at 02:39:16AM +0200 Sender: weis On Fri, Jul 02, 1999 at 02:39:16AM +0200, Pierre Weis wrote: > > As far as I remember, making OCaml (at least under Unix) a "true" > > scripting-language (=with human-readable "#!"-scripts) is not so easy to > > achieve: only binaries may be used as interpreters of "#!"-scripts, which > > is not currently possible with the way the toplevel "ocaml" is designed - > > it needs to be a byte code file. Are there already any convenient ways > > around this problem? > > Using byte code for scripting is not so comfortable and I think that > > OCaml would give a wonderful language for "true" scripting... > > I use a very simple way to achieve this: just tell the unix system to > execute the right ocaml interpreter, then I execute the file as > usual. > > For instance: > > pauillac:~$ cat > essai > #!/usr/local/bin/ocaml > > print_string "Hello world!"; print_newline();; > exit 0;; > ^D > pauillac:~$ chmod a+x ./essai > pauillac:~$ ./essai > Hello world! I don't get the same, why : sh-2.02$ cat essay #!/usr/local/bin/ocaml print_string "Hello world!"; print_newline();; exit 0;; ^D sh-2.02$ ./essai ./essai: line 2: syntax error near unexpected token `;' ./essai: line 2: `print_string "Hello world!"; print_newline();;' Friendly, Sven LUTHER