On Mon, 21 Feb 2011 12:18:54 +0100, Magnus Lie Hetland wrote:

> On 2011-02-20 19:22:20 +0100, Magnus Lie Hetland said:
> 
>> On 2011-02-19 22:25:31 +0100, Nick Sabalausky said:
>> 
>> [snip]
>>> Unfortunately, rdmd doesn't seem to have gotten much attention lately.
>>> I've had a few patches for it sitting in bugzilla for a number of
>>> months. (Not that I'm complaning, I realize there's been other
>>> priorities.)
>> 
>> I see. Kind of surprising, given that rdmd is distributed in the
>> official DMD zip file. But, yeah, no complaints. :)
>> 
>>> Actually, if you want, you can grab a version of rdmd.d with my
>>> patches applied here:
>>> http://www.dsource.org/projects/semitwist/browser/trunk/rdmdAlt.d
>> 
>> Thanks!
> 
> Humm. I'm still using the rdmd I had (it seems to work, so as long as I
> have already compiled it... ;)
> 
> However: I'm a bit baffled by the --shebang option. What's its purpose,
> really? If I use rdmd without it in a shebang line, it seems to work
> fine. If I *do* use --shebang, the code doesn't seem to be
> compiled/executed at all...
> 
> It seems like it interprets args[1] as a single string containing all
> the arguments, splitting it into separate items. That seems well an good
> -- except (in OS X, at least) it doesn't seem to be needed (I get my
> arguments just fine without it, and the shebang-line switches work well)
> ... and it doesn't seem to work (that is, with --shebang, nothing
> happens).
> 
> Any thoughts on this?

Say you have a file "myscript", that starts with the line

    #!/path/to/interpreter --foo --bar

If you run this as

    ./myscript --hello --world

then the args[] received by the interpreter program looks like this:

    args[0] = "/path/to/interpreter"
    args[1] = "--foo --bar"
    args[2] = "./myscript"
    args[3] = "--hello"
    args[4] = "--world"

This is the case on every shell I've tried on Linux, at least.  So if you 
have multiple rdmd options, it should in principle need --shebang to know 
that it is being run in a shebang line, so it can expand args[1].

I don't know why it works without --shebang for you, though. :)

-Lars

Reply via email to