Read-eval loop with prompt + user input

David T. Lewis lewis at mail.msen.com
Sat Mar 16 14:38:01 UTC 2002


On Fri, Mar 15, 2002 at 09:57:40PM +0100, Hannes Hirzel wrote:
> 
> On 15 Mar 2002, Martin Drautzburg wrote:
> 
> > I guess what I am looking for is something like "terminal" and a way
> > to read() and write() from/to it procedurally speaking.
> > 
> Look at the command shell goodie by Dave Lewis
> http://minnow.cc.gatech.edu/squeak/1914
> 
> HJH 

The methods in category "command scripting" of CommandShell may be
what you are looking for to read and write to a "terminal" in a
procedural way. Try this:

| shell result |
shell _ CommandShell new.
shell open. "Do this only if you want to see the terminal display"
result _ shell command: '2 + 2'.
result succeeded
	ifTrue: ['congratulations, you have successfully evaluated 2 + 2']
	ifFalse: ['the evaluation failed']

Dave
 



More information about the Squeak-dev mailing list