Loading ...
Sorry, an error occurred while loading the content.

Re: "ocaml_beginners"::[] Command-line argument oddity

Expand Messages
  • Bill James
    ... I already tried that. Doesn t help. ... No, it s OCaml s doing, although I am using the windoze shell. ruby -e p ARGV foo bar [ foo , bar ] ruby -e p
    Message 1 of 4 , Apr 1, 2009
    • 0 Attachment
      --- In ocaml_beginners@yahoogroups.com, Adrien <camaradetux@...> wrote:
      >
      > What you're seeing is actually a feature of your shell that is called
      > an at-response file.
      > IIRC, when giving a filename preceded with @, it will try to use that
      > file as a list of answers for your program. It should be roughly
      > equivalent to unix's "<<".
      >
      > Using quotes around the argument could help this problem.

      I already tried that. Doesn't help.

      > Also, this
      > only exists in the windows shell afaik.

      No, it's OCaml's doing, although I am using the windoze shell.

      ruby -e "p ARGV" foo bar
      ["foo", "bar"]

      ruby -e "p ARGV" foo @bar
      ["foo", "@bar"]


      Let's try a batch file named "test.bat".

      @echo off
      echo %1
      echo %2


      .\test.bat foo bar
      foo
      bar

      .\test.bat foo @bar
      foo
      @bar


      Let's try compiled FreeBasic.

      .\command foo @bar
      exe name= .\command
      arg 1 = "foo"
      arg 2 = "@bar"

      >
      >
      > ---
      >
      > Adrien Nader
      >
      > On 31/03/2009, Bill James <w_a_x_man@...> wrote:
      > > The program:
      > >
      > > Array.iter print_endline Sys.argv
      > >
      > >
      > > ocamlopt try.ml -o try.exe
      > >
      > >
      > >>> try foo bar
      > > try
      > > foo
      > > bar
      > >
      > >
      > >>> try foo @bar
      > > Cannot open file bar
      > >
      > >
      > >
      > >
      > > ------------------------------------
      > >
      > > Archives up to December 31, 2008 are also downloadable at
      > > http://www.connettivo.net/cntprojects/ocaml_beginners/
      > > The archives of the very official ocaml list (the seniors' one) can be found
      > > at http://caml.inria.fr
      > > Attachments are banned and you're asked to be polite, avoid flames
      > > etc.Yahoo! Groups Links
      > >
      > >
      > >
      > >
      >
    • ygrek
      On Wed, 01 Apr 2009 16:44:26 -0000 ... Yes, it is OCaml, in windows builds only, see caml_expand_command_line. Probably the reason for such behavior is that
      Message 2 of 4 , Apr 17, 2009
      • 0 Attachment
        On Wed, 01 Apr 2009 16:44:26 -0000
        "Bill James" <w_a_x_man@...> wrote:

        > No, it's OCaml's doing, although I am using the windoze shell.

        Yes, it is OCaml, in windows builds only, see caml_expand_command_line.
        Probably the reason for such behavior is that cmd shell doesn't expand wildcards so OCaml does it himself.

        --
        ygrek


        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.