__stdin.d(2): Error: found End of File when expecting }

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Jul 17 19:51:20 UTC 2019


On Wed, Jul 17, 2019 at 07:05:20PM +0000, Andre Pany via Digitalmars-d-learn wrote:
> Hi,
> 
> this scripts throws 2 times this error:
> __stdin.d(2): Error: found End of File when expecting } following compound
> statement
> __stdin.d(2): Error: found End of File when expecting } following compound
> statement

My first suspicion is that the shell is interpreting metacharacters in
your string and thereby mangling it.


[...]
> ```
> #!/bin/bash
> 
> text="
> import std;
> 
> void main()
> {
>     while(true)
>     {
>         string enemy1 = readln().strip;
>         int dist1 = to!int(readln().strip);
> 
>         string enemy2 = readln().strip;
>         int dist2 = to!int(readln().strip);
> 
>         // Write an action using writeln()
>         writeln(dist1 > dist2 ? enemy2 : enemy1);
>         // Enter the code here
>     }
> }"
> 
> curl -fsS https://dlang.org/install.sh | bash -s dmd-2.087.0
> source ~/dlang/dmd-2.087.0/activate
> echo $text | dmd -
> ```
> 
> what is here wrong?
> ( I execute it using on Ubuntu 18.04 LTS using WSL)
> 
> Kind regards
> André

-- 
IBM = I'll Buy Microsoft!


More information about the Digitalmars-d-learn mailing list