[Gambas-user] exec also working as shell why?

Tobias Boege taboege at gmail.com
Fri Jan 10 20:41:53 CET 2020


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


More information about the User mailing list