This is a question about how to read standard input in UNIX (bash).
I would like to write code in an easy to use editor (BBEdit) and use maple to take input from what other systems would refer to as STDIN or $stdin. The motivation for using an external text editor is to reduce the memory burden on the Maple editor in a program that rotates hundreds, hopefully thousands, of Maple points and other objects (See: http://www.mapleprimes.com/questions/123184-Sluggish-Editor-Balks-On-Galaxy). I want to break my program up into smaller programs that could each send data to standard output in a pipe leading to maple, which would do the plotting, I wrote the following little scripts based on my best understanding of the Programming Guide.
# filename: pipemaple.sh
#!/bin/bash
ls | receive.mpl
#--------------------------
# filename: receive.mpl
#!/Library/Frameworks/Maple.framework/Versions/Current/bin/maple -cw
a := readline(terminal);
#----------------------------------
This is the result of execution of pipemaple.sh
GARYs-iMac:shell gary$ pipemaple.sh
/Users/gary/scripts/maple/receive.mpl: line 3: syntax error near unexpected token `('
/Users/gary/scripts/maple/receive.mpl: line 3: `a := readline(terminal);'
Clearly, I am missing something. Mint makes no report of errors in receive.mpl. Others on the forum appear to be doing similar things, but I haven't seen sample scripts. It would be helpful if someone would post a few simple examples, that would also incude writing to standard output.
Mac w OS X, 10.4.6, 3.06 GHz Intel Duo with 4GB RAM, Maple14 Student