November 21, 2015 why --shebang for rdmd? | ||||
---|---|---|---|---|
| ||||
Hello. The following code works fine for me: #! /usr/bin/env rdmd import std.stdio; void main() { writeln(2); } So what is the use of the --shebang option of rdmd? http://dlang.org/rdmd.html does not shed much light on this. Thanks. -- Shriramana Sharma, Penguin #395953 |
November 21, 2015 Re: why --shebang for rdmd? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shriramana Sharma | On Saturday, 21 November 2015 at 05:20:16 UTC, Shriramana Sharma wrote: > Hello. The following code works fine for me: > > #! /usr/bin/env rdmd > import std.stdio; > void main() { writeln(2); } > > So what is the use of the --shebang option of rdmd? http://dlang.org/rdmd.html does not shed much light on this. > > Thanks. Here's the source: https://github.com/D-Programming-Language/tools/blob/master/rdmd.d#L59-L64 Linux has a restriction for shebang lines: There can only be only command line argument. E.g.: // foo.d #!/usr/bin/rdmd --compiler=/usr/bin/dmd --loop When running ./foo.d, the kernel would execute rdmd with the following arguments: ["/usr/bin/rdmd", "--compiler=/usr/bin/dmd --loop", "./foo.d"] I.e., the entire command line after the executable is merged into one argument. With `--shebang`, rdmd splits the argument before processing it. That's how I understand it, anyway. |
Copyright © 1999-2021 by the D Language Foundation