[Gambas-user] Line continuation

Tobias Boege taboege at ...626...
Sun Dec 8 18:00:23 CET 2013


On Sat, 07 Dec 2013, MinnesotaJon wrote:
> If you are using SHELL, you can assign lines to variables.  If the string
> continues on multiple lines, assign the text to string variables, and
> concatenate those variables.  
> The example below merely shows SHELL accepting a string variable as its
> command string:
> 
> DIM sRes as String
> DIM shellString as String  
> 
>   shellString = "cat /proc/meminfo"
>   Shell shellString To sRes  
> 
> If you use EXEC, the flexibility is more limited, as the command cannot be
> contained in a variable, but the following will work:
> 
> DIM execString as String
> DIM sRes as String
>   execString = "/proc/meminfo"
>   Exec ["cat", execString] To sRes
> 

Of course, it can:

--8<----------------
Dim aExec As String[]
Dim sRes As String

aExec = ["cat", "/proc/meminfo"]
' Use aExec.Add() to add more arguments
Exec aExec To sRes
--8<----------------

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list