I am working on a Turtle based shell script. I'd like it to be able to, optionally, accept piped in text in place of an argument. After reading the docs and playing with the stdin Turtle function to no avail, I realize I'm stuck.
Is something like this supported by Turtle? If so, how do I do it?
I think the answer is 'no' it is not supported by Turtle. But it is supported by Haskell. Here's how I did it:
The key insight for me is that I need to check for the existence of the piped in text before trying to read it, as reading an 'empty' handle blocks while waiting for input, but reading a 'full' handle gets the existing content.