Difference between revisions of "Shell.run"

From ComputerCraft Wiki
Jump to: navigation, search
(Updated to use standard Function template)
Line 1: Line 1:
 +
{{lowercase}}
 +
{{Function
 +
|name=term.write
 +
|args= [[string (type)|(string)]] program, [[string (type)|(string)]] args
 +
|returns=nil
 +
|api=shell
 +
|addon=ComputerCraft
 +
|desc=Runs the specified program with the specified arguments
 +
|examples=
 
{{Example
 
{{Example
|desc=shell.run(String programLocation, String sArgs), This function is used to run a program at the desired location with the sArgs as the          arguments.
+
|desc=Runs the program "myprogram" with arguments "test" and "ing"
|code=shell.run("myprogram", "test")
+
|code=shell.run("myprogram", "test", "ing")
|output=Runs the program "myprogram" with arguments "test"
+
|output=The program myprogram with the arguments "test" and "ing"
 +
}}
 
}}
 
}}
 
Here is a example how to run programs with custom input.
 
 
stringArgs=read() -- You input a line of string, and each space makes a argument, such as "arg1 arg2". Argument 1 is "arg1".
 
shell.run("myprogram", stringArgs)
 
-- runs the program. myprogram would have to be located on the main directory of the computer for this to work.
 

Revision as of 02:30, 24 September 2012


Grid Redstone.png  Function term.write
Runs the specified program with the specified arguments
Syntax term.write((string) program, (string) args)
Returns nil
Part of ComputerCraft
API shell

Examples

Grid paper.png  Example
Runs the program "myprogram" with arguments "test" and "ing"
Code
shell.run("myprogram", "test", "ing")
Output The program myprogram with the arguments "test" and "ing"