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

shell argument execution behaviour

Started by Djerun, 05 February 2013 - 03:30 PM
Djerun #1
Posted 05 February 2013 - 04:30 PM
Title:shell argmument execution behaviour
So I tried to call a shell with arguments to run a string that has been verified to be a valid program (I do not want to run it in the same shell as the current program)

I used shell.run("shell", cmd) to accomplish this and here is what I expected:

new shell loads, reads command line arguments, executes given command(s), shell exists

here is what happened:

new shell loads, shell prints boot message, reads command line aruments, executes given command using other commands as additional parameters for the first program, shell waits for input

Any chance to get the desired result without rewriting the shell?

also: touch, cat?
ChunLing #2
Posted 05 February 2013 - 05:14 PM
I think you can use the shutdown command to exit from child shells till you get back to the parent shell.
Djerun #3
Posted 05 February 2013 - 05:46 PM
[…] ,executes given command using other commands as additional parameters for the first program, […]

means shell.run("shell", "cmd1 args1 cmd2 args2") will start a new shell running cmd1 with args1 cmd2 and args2 as commands while shell.run(shell, "cmd1 args1", "cmd2 args2") wont work so when I can't issue two commands at once, for now I changed shell to set bExit to true when there are arguments and also only print os.version() when there aren't but when the nex update comes I'd have to replace the files again and on top my programs aren't compatible to others anymore, unless I put the edited version in /bin and tell my programm to use /bin/shell instead of shell

I also put my own touch cat and echo into the rom for now but it's the same issue with an update (and I really don't want to use use a setup disk on every new computer/turtle)

EDIT: Oh and for now I used the calling program to split the program calls and have a loop executing them one by one