import std.stdio; void main() { foreach(line; stdin.byLine()) { writeln("Got input line: ", line); } }
dmd dtest.d -of"dtest"
ls -l | ./dtest
This should make D a perfect language for creating small utility apps for parsing text, that you can pipe to!
More tutorials can be found here
Comments
Shebang
Note that D also supports shebang.
#!/usr/bin/rdmd
import std.stdio;
void main() {
// code
}
$ chmod +x dtest.d
$ ./dtest.d
$ ls -l | ./dtest