[Gambas-user] exec also working as shell why?
PICCORO McKAY Lenz
mckaygerhard at gmail.com
Sat Jan 11 14:40:55 CET 2020
originally i was to grep a configuration file..later due the complicated
process changed to a cat .. an then due the inherent problems of make a
complicated process use directo EXEC "commando" to Variable...
now my code evoluted to "File.Load("somefile")
HOLY SHIT! !!! that's not was that i want! X-D
El vie., 10 de ene. de 2020 a la(s) 15:42, Tobias Boege (taboege at gmail.com)
escribió:
> On Fri, 10 Jan 2020, T Lee Davidson wrote:
> > On 1/10/20 11:38 AM, PICCORO McKAY Lenz wrote:
> > > i have a code where i want to pass content to main.. but i never
> raised the content:
> > > cadena only are filled with content after main raises end, why .. if i
> not use shell?
> > > i attached the project
> > >
> > > i have a class and a module main, class are:
> > >
> > > Public cadena As String = "ver"
> > > Public linea As Collection
> > > Private lineas As String[]
> > >
> > > Public Sub Main()
> > > Exec ["cat", "/etc/courier/authdaemonrc"] For Read As "Processo"
> > > End
> >
> > Perhaps because you didn't tell the interpreter to "Wait" for the
> command to finish before continuing on?
> >
> > If you're simply trying to get the contents of
> "/etc/courier/authdaemonrc"
> > for parsing, then why not just retrieve it into a string variable and
> then
> > parse it without bothering with Process_Read()?
> >
> > For example:
> > Exec ["cat", "/etc/courier/authdaemonrc"] to cadena
> > lineas = Split(cadena, gb.NewLine, "", True)
> > For a = 0 To lineas.max
> > ...
> > Next
> >
>
> `cat some-file` is also built into Gambas as `File.Load("some-file")`.
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200111/27271792/attachment.html>
More information about the User
mailing list