English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    
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: -- (:)
From: Maxence Guesdon <maxence.guesdon@i...>
Subject: Re: [Caml-list] Wildcard expansion/command line

> So, how does it work? 

*the shell* expands your unquoted wildcards before passing the args to your program.

> 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*"

You will have :
 ./myprog m*       -> Sys.argv.(1) = "m1.txt" and Sys.argv.(2) = "m2.txt"
 ./myprog m?.txt   -> Sys.argv.(1) = "m1.txt" and Sys.argv.(2) = "m2.txt"
 ./myprog "m*"     -> Sys.argv.(1) = "m*" since the * is inside quotes

Maxence Guesdon
-------------------
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