An easy way to pipe input into shell commands?

Dar Scott dsc at swcp.com
Sat Oct 2 10:56:38 EDT 2010


On Oct 2, 2010, at 6:31 AM, David Bovill wrote:

> Is there a neat way to pipe input into shell commands from STDIN?

You might consider the slave process feature of LiveCode which has  
been revamped in 4.5.  Use 'open process' to run the command-line  
tool.  Use 'write ... to process' to write to its STDIN.  Get the  
result with 'read from process'.  There is an example in the revision  
notes.  This is not new.  Working well is presumably new.

The limitation is that when you close the pipe to the process,  
LiveCode (that is, the version of Revolution I tested years ago-- 
things may have changed) also closes the pipe from the process, so  
this would not be good for things that do their work after the close,  
such as sort.

> put "echo 'Hello world!' | commandLineThatTakesSTDIN" into someShell
> put shell (someShell)

Cool!

Dar Scott


--
**************************************
Dar Scott
Dar Scott Consulting  and  darzLAB
8637 Horacio Place NE
Albuquerque, NM 87111

Lab, office, home:  +1 505 299 9497
Fax:                try 299-9497
Skype:              lets set up a time

http://www.swcp.com/dsc
dsc at swcp.com

Computer programming and tinkering
**************************************






More information about the Use-livecode mailing list