FutureBasic Logo

<<    Index    >> FutureBasic

open "UNIX"   statement



Syntax
open "UNIX", fileID, UNIXcommand$

Description
Mac MacOS X brings a wealth of commands with its UNIX foundation. These commands are easy to access from FutureBasic. You may establish one or several simultaneous channels by opening them as files. Each channel should have a unique file number. There is a theoretical maximum of 255 files or channels that may be opened at once.
Once the channel has been opened, you read from the file to accept the resulting list from UNIX. (Exception: some UNIX commands perform a task without responding to the user, so no file reading is required.) When the operation is complete, close the channel as you would any file; with the close statement.
There are literally hundreds of books written about UNIX commands. Suffice it to say that if the Mac supports a specific UNIX command, it may be accessed through open "UNIX"

Example
dim as Str255 a
window 1,, (0,0,600,550)
text @"Menlo", 10
// print a title-string then list a directory
open "UNIX", 2, "echo ""Root Directory""; ls -l"
do
   line input #2, A
   print a
until eof(2)
close 2

HandleEvents

See also
close