Can't change directory with shell(cd)

Ken Ray kray at sonsothunder.com
Fri May 2 02:31:57 EDT 2008




On 5/1/08 5:54 PM, "Michael D Mays" <michael.rr at mdmays.com> wrote:

> I'm doing this
> 
>   answer folder ""
>   put it into aPath
>   put "cd "&aPath into aRequest
>   put aRequest into fld 1
>   put shell(aRequest) into fld 2
>   put shell("ls") into fld 3
> 
> No matter which folder I chose, Rev's 'Home' folder is the directory
> listed.
> When I cut and paste fld 1 into the Terminal, ls works as expected.
> 
> What am I doing wrong or is this a 'feature';)?

The problem is that you're doing two separate shell calls, each one
evaluated based on the current folder (which is Rev's Home folder). You need
to make a single shell call that does both tasks. For Mac, that means
separating them by semicolons:

  put shell("cd /;ls")

This will get a directory listing of the root  drive. For Windows, you need
to use an ampersand instead of a semicolon, like this:

  put shell("cd c:\ & dir")






More information about the use-livecode mailing list