Difference between revisions of "Shell.run"

From ComputerCraft Wiki
Jump to: navigation, search
Line 1: Line 1:
{{stub}}
+
{{Example
 +
|desc=shell.run(String programLocation, String arguments), This program is used to run a program with code instead of type. such as if you typed "myprogram test".
 +
This does not produce a new line, and anything else printed or written after this will be on the same line.
 +
|code=shell.run("myprogram", "test")
 +
|output=Runs the program "myprogram" with arguments "test"
 +
}}
 +
 
 +
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 01:15, 24 September 2012

Grid paper.png  Example
shell.run(String programLocation, String arguments), This program is used to run a program with code instead of type. such as if you typed "myprogram test". This does not produce a new line, and anything else printed or written after this will be on the same line.
Code
shell.run("myprogram", "test")
Output Runs the program "myprogram" with arguments "test"



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.