[Gambas-user] Shell - commands with arguments doesn't work
Jussi Lahtinen
jussi.lahtinen at ...626...
Fri May 31 00:31:26 CEST 2013
Hmmm... no "--help" seems to be documented option... Then I don't
understand why it's output goes to standard error.
But it does anyway.
Jussi
On Fri, May 31, 2013 at 1:29 AM, Jussi Lahtinen <jussi.lahtinen at ...626...>wrote:
> It's because ifconfig is bit weird... there is no --help option and so
> output is directed to standard error output (invalid option).
>
> This creates empty file:
> $ ( ifconfig --help ) 1> test.txt
>
> This creates file with the actual content:
> $ ( ifconfig --help ) 2> test.txt
>
>
> So, to use it with gambas do this:
> Shell "ifconfig" To somevar
>
>
> Jussi
>
>
>
>
> On Fri, May 31, 2013 at 12:50 AM, Jesus <ea7dfh at ...2382...> wrote:
>
>> El 30/05/13 21:35, Kende Krisztián escribió:
>> > An interesting example, why do not you use native methods?
>> >
>> > Dim item As String
>> >
>> > For Each item In Dir(User.Home).Sort()
>> >
>> > With Stat(User.Home & "/" & item)
>> >
>> > Print .Auth & " " & .User & " " & .Group & " " & .Size & " " &
>> .LastModified & " " & item
>> >
>> > End With
>> >
>> > Next
>> >
>> >
>> >> Hi all
>> >>
>> >> AFAIR this used to work until now:
>> >>
>> >> Shell "ls -la" To variable
>> >> Exec ["ls", "-la"] To anothervariable
>> >>
>> >> But now, whatever command I use, if it has one or more arguments
>> >> beginning with a dash or double dash, I don't get any output.
>> >>
>> >> Quoting it with Shell$() function does not help. Also, I've tried
>> >> using process reading, to no avail.
>> >>
>> >> If you would issue the command without arguments, it then works fine.
>> >>
>> >> Is this a bug, or am I doing something wrong?
>> >>
>> >> Regards
>> >>
>> >> Gambas 3.4.90 r5682
>> >>
>>
>> That's not the case. What I wanted to point out is why some commands
>> does not work when some arguments are given. Obviously, my first example
>> is pointless.
>>
>> Have you tested the following?
>>
>> Shell "ifconfig --help" To somevar
>>
>> Why this does not return anything?
>>
>> Regards
>> --
>> Jesus Guardon
>>
>>
>> ------------------------------------------------------------------------------
>> Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
>> Get 100% visibility into your production application - at no cost.
>> Code-level diagnostics for performance bottlenecks with <2% overhead
>> Download for free and get started troubleshooting in minutes.
>> http://p.sf.net/sfu/appdyn_d2d_ap1
>> _______________________________________________
>> 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