www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - why --shebang for rdmd?

reply Shriramana Sharma <samjnaa_dont_spam_me gmail.com> writes:
Hello. The following code works fine for me:


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.

-- 

Nov 20 2015
parent Marc =?UTF-8?B?U2Now7x0eg==?= <schuetzm gmx.net> writes:
On Saturday, 21 November 2015 at 05:20:16 UTC, Shriramana Sharma 
wrote:
 Hello. The following code works fine for me:


 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 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.
Nov 21 2015