On Friday, 1 March 2019 at 11:38:51 UTC, BoQsc wrote:
On Friday, 1 March 2019 at 09:27:33 UTC, Cym13 wrote:
On Friday, 1 March 2019 at 09:00:43 UTC, BoQsc wrote:
[...]

In such questions it's important to show your shebang since that's what runs your script.

Given your symptoms I guess you're using the following:

#!/bin/env rdmd

And indeed rdmd won't call your script if it doesn't have the proper extension.

Try using this instead:

#!/bin/dmd -run

The shebang I used: #!/usr/bin/env rdmd

I was visiting Dlang Tour and that's where I've got an example of shebang usage, directly from there:
https://tour.dlang.org/tour/en/welcome/run-d-program-locally#/on-the-fly-compilation-with-rdmd

The shebang you suggested actually works perfectly:
#!/bin/dmd -run


"And indeed rdmd won't call your script if it doesn't have the proper extension."

Then why does Dlang Tour includes shebang: #!/usr/bin/env rdmd

Instead of the one you mentioned, that is fool proof. (#!/bin/dmd -run)

Is that an error/mistake in Dlang Tour guide?

Well, because it isn't fool proof either ;-)

It won't work once you start using more files as you would then need the -i flag , but unfortunately most systems don't support more than one shebang argument.

I think it's simply a missing feature of rdmd to accept files without an extension as D programs (though of course the tour could be improved to be more explanatory here too).

Reply via email to