This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Filyx20's profile picture

shell.run from a disk drive on the wire network

Started by Filyx20, 20 August 2014 - 02:43 PM
Filyx20 #1
Posted 20 August 2014 - 04:43 PM
this is a simple question. i need to run a program that will need a regular updating on 51 computer, so on each computer i will do a startup saing to shell.run from the disk drive on drive_5.

On drive_5 there will be a floppy disk that will have the program i need and there will be a computer for editing the flopy disk.

so this is my question. how to run a program from the flopy disk when it's not on the side of the computer?

tanks to all helpers who will help my problem.

P.S. sorry for bad spelling, i live in Québec and i usely talk français.

Filyx20
Bomb Bloke #2
Posted 21 August 2014 - 06:01 AM
shell.run("disk5/program")

Remember, you need to right click the modem attached to the disk drive to enable it, or the attached computers won't be able to see it.

The exact folder which refers to the disk drive you want varies depending on the amount of disk drives with disks in them connected to the network. If you wanted to check all attached disk drives for a file with a certain name, you could do something like:

local fileList = fs.list()

for i=1,#fileList do if fs.exists(fs.combine(fileList[i],"yourTargetProgramNameHere")) then
	shell.run(fs.combine(fileList[i],"yourTargetProgramNameHere"))
	break
end end
Edited on 21 August 2014 - 04:01 AM
Filyx20 #3
Posted 21 August 2014 - 05:41 PM
second question, if i do
local x = Instrumentum
shell
.run(fs.combine(fileList[i],"redstoneAspectCall"))
will the x variable be pass on to the program i shell.run cause my 51 computer need to logistic pipe request 51 diferent mana been?
KingofGamesYami #4
Posted 21 August 2014 - 07:46 PM
second question, if i do
local x = Instrumentum
shell
.run(fs.combine(fileList[i],"redstoneAspectCall"))
will the x variable be pass on to the program i shell.run cause my 51 computer need to logistic pipe request 51 diferent mana been?
No. If you define it globally, it will be though.

x = Instrumentum
theoriginalbit #5
Posted 22 August 2014 - 06:41 AM
but as opposed to polluting the global space, the best way would be to have it as an argument for the program.

Main program

local x = 5
shell.run("other", x)

Other program

local args = {...}
print( args[1] ) --# this will print 5