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

Jaap Cramer jaap_cramer at ...67...
Fri Jan 25 15:34:30 CET 2008


in stead of using 2 command you can alsdo do

$ ls /tmp

The output can be stored in a variable using the TO operant

SHELL "ls /tmp" TO sOutput
PRINT sOutput

jaap

PS
Yesterday I send two mails, but it seams nobody got them. mailinglist error? Fortunately other people gave the same advise, so the people in question were helped. Please confirm this mail is recieved...

----------------------------------------
> Date: Fri, 25 Jan 2008 08:29:34 -0600
> From: m0e.lnx at ...626...
> To: rterry at ...1823...; gambas-user at lists.sourceforge.net
> Subject: Re: [Gambas-user] Hours of strugglin with EXEC and SHELL
> 
> 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  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
>>
> 
> -------------------------------------------------------------------------
> 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

_________________________________________________________________
Bekijk Yes-R's real life soap op MSN Video!
http://video.msn.com/video.aspx?mkt=nl-nl&tab=m1192527562294&vid=8aff5b76-b78d-4b55-8b64-ef7e1d73aab2&playlist=videoByUuids:uuids:50b732c2-c105-41e9-adf0-36bd627d4eaa,0813da8c-031b-423f-a79d-35d925aee805,5cce447e-948d-43af-9862-45bb6bb9d6d8,6a39138c-f562-4254-be70-9d93343650f8,f9b8d78f-05a4-4c74-8e4b-28d20a4037ab&from=NLNL_Yes-R



More information about the User mailing list