Howdy, Garold:
Command line args that use - or + can be quoted. If you
need quotes, at least under unix, you can escape the
quotes.
Using the following script which I called "rargs":
#!/usr/local/bin/rebol -q
REBOL [Title: "Rargs"]
foreach item [
system/options/args
system/script/args
][ print [mold :item "==" item]]
You can see some examples:
rargs print \"hello\"
system/options/args == print "hello"
system/script/args == print "hello"
rargs \"+-\"
system/options/args == "+-"
system/script/args == "+-"
or...
rargs {+-}
system/options/args == {+-}
system/script/args == {+-}
If you're running under windows, I'm not sure what the
comparable .bat file for above would be like. Would it
just call rebol on the script you wanted? Maybe so... Not
sure about what you'd do under mac or amiga to do shell
script kind of stuff. Maybe someone will educate me. :-)
Oddly enough, I just wrote a little article on using REBOL
for shell scripts:
http://www.cs.unm.edu/~whip/rebol-unix-shell.html
-jeff
> Since I didn�t find anything for processing command line
> arguments, I decided to investigate the issue as my first
> REBOL script.
>
> I use command line programs heavily from other programs.
>
> REBOL eats ALL arguments starting with �-� or
> �+�. Since �/� is used in paths, it isn�t
> available as a flag either.
>
> Is there a REBOL standard for option flags?
>
> Is there a standard REBOL script for handling command line
> arguments that I missed?
>
> Any suggestions for improvements of this script?
>
> Should I move the parse rules inside the parse-args
> function?
>
> Is there a better choice for names?
>
> Thanks,
>
> Garold (Gary) L. Johnson DYNAMIC Alternatives
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 562 802 1639