Carefully reading the documentation, it looks like this arg scheme only
works when invoking REBOL, NOT from the DO command. Thinking about this, it
makes sense. That is, how would DO know how many arguments (if any) to
gobble up?

-------------------------------------------------------------
; Save the following script:

REBOL [
        Title:  "Test"
        Author: "Michael Jelinek"
        Date:   2000/03/15
        File:   %test.r
        Email:  [EMAIL PROTECTED]  ;for problems or changes
        Purpose: {Test programming ideas}
]

print mold system/script/args
-------------------------------------------------------------
; then, from the OS command line, type:

rebol test.r "hey"
-------------------------------------------------------------

- Michael Jelinek

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 15, 2000 9:48 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] pleh! pleh! basic reborientation needed!


I started out with much energy, and am now floundering on the simplest
things.

I cannot get *anything* to do with command line arguments to work at all.
I have tried c&p-ing examples from messages here, and they don't work.

(Well... K.R.'s path example seemed to work for what it was worth, 
and I now surround the inner part of each script with:
-------------------------------------------------------------
savecd: system/script/parent/path
...
change-dir savecd
-------------------------------------------------------------
so I don't have to change-dir back after every do %...)

Anyway, something as simple as...

>> do %projects/test/params.r "doggy"
(alternately: do %projects/test/params.r doggy
          or: do %projects/test/params.r [doggy]
          or: do %projects/test/params.r ["doggy"])

params.r (just the guts, ma'am)
-------------------------------------------------------------
; yeeth! just gimme the first one!
either string? system/script/args [
        args: parse system/script/args none
        print args/1    
        
][
        print "No arguments passed."
]
-------------------------------------------------------------
or should that be:
-------------------------------------------------------------
; by this time, I really don't care if there were no params!
args: parse system/script/args none
forall args [
        print args/1
]
-------------------------------------------------------------
finally:
-------------------------------------------------------------
>>do %something "please!"
-------------------------------------------------------------

I've tried every combination I can think of for the last hour without
success.
Like using system/options/args... different looping constructs, different
number
of parameters on the command line, etc. If anyone wants to observe me losing
it
in detail, I can send a copy (13K) of my last session history on request. 

Going (?) nuts.

-- 
Pete Wason|"LWATPLOTG"|[EMAIL PROTECTED]|[EMAIL PROTECTED]|CUCUG|TA|PHX

PS: This whole thing strikes me as kind of funny, since the first thing I
did in
rebol was a directly interpreted one-liner that checked a webserver for its
status and sent an email if it was down -- which worked on the first try.
Maybe
it was something I ate for breakfast...

Reply via email to