Page 1 of 1

Running shell commands

Posted: Mon May 03, 2010 12:09 am
by exheusden
Trying to run a few shell commands, using the shell function, as follows:

on mouseUp
put shell ("cd /Users/davidneale/Documents/Web\ stuff/David\'s\ Web\ stuff/Telenet\ Webspace/elvis/originals/eBook")
put shell ("ls")
get shell ("zip -q0X ROE.epub mimetype")
get shell ("zip -qXr9D ROE.epub *")
end mouseUp

I put the put shell ("ls") in as a check, when I couldn't get the rest to work. This line actually does return a directory list, but it shows only the contents of the Revolution directory (in other words, the cd command was not executed correctly).

Can anyone tell me what I am doing wrong?

Re: Running shell commands

Posted: Mon May 03, 2010 12:50 am
by RRobert
Set the defaultFolder property to the directory you like to work in.

Robert

Re: Running shell commands

Posted: Mon May 03, 2010 2:07 am
by sturgis
The reason its not working as you intend is because each shell call starts a separate shell instance. Setting the directory in the first shell call has no impact on the subsequent shells.

If you do as Rrobert says that becomes a non-issue.

To get a visual of how this works, try a simple script like

Code: Select all

put shell ("cd /Users/davidneale ; ls") -- switch dir, and get a listing in the same shell.
put shell ("ls") --get a listing in a seperate shell. Should be back at the runrev default location.

Re: Running shell commands

Posted: Mon May 03, 2010 8:55 am
by exheusden
Thanks for your help. Works fine now.