lc shell and command line

Bernard Devlin bdrunrev at gmail.com
Mon Nov 14 07:26:09 EST 2011


put shell("cd ..; pwd") would appear to do what you want.

There is going to be no state maintained between different calls of
shell().  Thus, changing to a directory in one calls is not (IMO)
going to be maintained on a subsequent call of shel|().  Concatenating
commands (as I did above using the semi-collon), will mean they run in
the same invocation.

If you use 'cd' inside a shell such as Tclsh, it will maintain the
state of the change in directory.  But even in something like Tclsh,
there are peculiarities around file globbing etc.

I guess you could try 'open process' and then 'talk' to the shell
opened that way.  Although it's not clear to me that both of you are
trying to do the same thing.  It looks like the OP may be planning to
use LiveCode as a general purpose shell-scripting language.  I'm not
sure that is possible any more.  The way he is invoking it is rather
like using PHP as a general purpose shell-scripting language.

Bernard


On Mon, Nov 14, 2011 at 8:12 AM, Peter Alcibiades
<palcibiades-first at yahoo.co.uk> wrote:
> I'm having trouble with the livecode shell and cd command also.
>
> pwd in a terminal does:
>
>     :~/  runrev 4.5/livecode-4.5.2$
>
> cd ..
>
>     :~/  runrev 4.5$
>
> pwd
>
>     runrev 4.5$
>
> If you do the exact same things using put shell("...."), this doesn't work.
> In particular,
>
>     put shell("pwd")
>
> does indeed return the working directory, but
>
>     put shell("cd ..")
>
> does not work at all.   Why not? Probably an obvious reason - is it
> something to do with escaping characters?
>
> Peter




More information about the use-livecode mailing list