[Gambas-user] Hours of strugglin with EXEC and SHELL

M0E Lnx m0e.lnx at ...626...
Fri Jan 25 15:29:34 CET 2008


The first gambas application that I wrote uses SHELL a lot... and I
came to find out that in gambas, the cd command wont do anything...
Say for instance, you need to first cd to /tmp and then run ls -al.
This WILL NOT WORK

PUBLIC SUB cdTEST()
SHELL "cd /tmp"
SHELL "ls -al"
END
In this case, when gambas executes the second command, it will return
the output of "ls" IN THE PROJECT'S DIRECTORY... not in "/tmp" as you
told it to in the first line

so, to accomplish this, you can use the bash concatenators (is that a
word)?? and write one-liners

PUBLIC SUB cdTEST()
SHELL "cd /tmp && ls -al" FOR READ
END
That should work

On Jan 24, 2008 8:23 PM, richard terry <rterry at ...1822...> wrote:
> Thanks for your suggestions, I think maybe I didn't make myself entirely
> clear.
> Yes the SHELL Commands did work as per your suggestion (as did mine), but even
> if the output of cd ...... etc ls -al prints the listing of the directory,
> the cd command dosn't change the working directory of the unzip command, ie
> the unzipped files are deposited in my home directory, not the directory I
> shelled to.
>
> Obviously I am missing something.
>
> Maybe another suggestion?
>
> Richard
>
>
> On Fri, 25 Jan 2008 09:43:07 am Stefano Palmeri wrote:
> > Alle 22:14, giovedì 24 gennaio 2008, richard terry ha scritto:
> > > Spent several hours struggling to no avail to understand the exec and
> > > shell commands including trying to dissect the console program supplied
> > > with gambas.
> > >
> > > Total frustration.
> > >
> > > I've selected a file/directory from a file box and that seems to work ok
> > >
> > >  PRINT FileChooser1.Dir
> > >  PRINT FileChooser1.Value
> > >
> > > The file is a zip file, and i want to unzip it in the same directory I
> > > selected i the box but, if and when (seems erratic) I can unzip it using
> > > this command:
> > >
> > >     SHELL "unzip" & " " & "-P" & "password" & " " & FileChooser1.Value
> > >
> > > the unzipped files get deposited in my home directory. Also I want to be
> > > able to show them inside my terminal. (I tried the READ WRITE
> > > combinations at the end of that line).
> > >
> > > Then I tried things like
> > >
> > >
> > >            SHELL "cd  /home/richard/coding" WAIT
> > >            SHELL "ls -al" WAIT
> >
> > Hi.
> >
> > You have to do:
> >
> > SHELL "cd  /home/richard/coding; ls -al" WAIT
> >
> > or
> >
> > SHELL "ls -al  /home/richard/coding" WAIT
> >
> > Bye,
> >
> > Stefano
> >
> > > and gambas just stops executin, or I tried copying from the console
> > > programs concepts.
> > >
> > >
> > >           ' $hProcess = EXEC ["ls"] FOR READ
> > >           ' $hProcess = EXEC ["cd", "/home/richard/temp"] WAIT
> > >
> > > Everything to no avail.
> > >
> > > I gave up after several hours, but to ease my frustration read 130 pages
> > > of the Gambas for Beginners pdf which I stumbled across at work today.
> > > Though based on version 1 it is very useful for me and to contribute to
> > > the Author I've ordered a paid copy.
> > >
> > > Regards and hopeful someone will be able to help me.
> > >
> > > Richard
> > >
> > > -------------------------------------------------------------------------
> > > This SF.net email is sponsored by: Microsoft
> > > Defy all challenges. Microsoft(R) Visual Studio 2008.
> > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > > _______________________________________________
> > > Gambas-user mailing list
> > > Gambas-user at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2008.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list