rdmd and shebang limits

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Jan 9 13:39:09 PST 2014


On 1/9/14 3:25 AM, Andrea Fontana wrote:
> I've just discovered that shebang line has a (very short) limit. Only
> 127 bytes are read from line
>
> It means that something like this doesn't work:
>
> #!/usr/bin/rdmd --shebang -I/asdasdasdasd/asdasdasdasd/asdasdasdasd
> -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/
>
>
> Is it possible to add a command line switch to read params from a simple
> file?
>
> For example:
>
>
> main.d:
> #!/usr/bin/rdmd --shebang --params ./rdmd-params.conf
> void main() { }
>
> rdmd-params.conf:
> -I/asdasdasdasd/asdasdasdasd/asdasdasdasd
> -I/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/qweqweqweqwe/

I think that's a shell limitation. I've long had the plan to experiment 
with it like this: if --shebang is the first argument, rdmd should just 
read the whole first line and exec() a shell with it. That would solve a 
variety of issues related to limitations and quoting quirks.

Andrei




More information about the Digitalmars-d mailing list