English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Wildcard expansion/command line
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-05-14 (07:57)
From: Jens Olsson <jenso@o...>
Subject: [Caml-list] Wildcard expansion/command line

This is my second time at the list. Feel good to be back :) Hope all of you are well! 

I have a question right away. It might not (probably not) be a Ocaml related question but I'll give it a shot!

I write a program that is invoked from the command line. All well, but when I was starting to make my program deal with wildcards I realized that the ocaml program gets its command line arguments expanded (if wildcards are used). I have included an example at the bottom of my mail to clarify if it is unclear what I mean.

Now, is this done by the OS or the shell? How do I controll this behaviour? Of course I can enclose any arguments within "" and expand any wildcards manually - but I figured, if programs like 'ls' don't have to use quotes, why should I. 

So, how does it work? 



Example: If a directory has two files m1.txt and m2.txt, and my ocaml program (here called myprog) is invoked with wildcards it would behave something like this:

Example call         Command line arg within my program
./myprog m*       -> Sys.argv.(1) = "m1.txt"
./myprog m?.txt   -> Sys.argv.(1) = "m1.txt"
./myprog "m*"     -> Sys.argv.(1) = "m*"

ie, wildcards are expanded before given to my program.

Powered by Outblaze
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners