How to get the stdout result of a Basic "shell" order?

The external command I want to call by a Basic “shell” order give its result on its “stdout” stream. How to obtain this result as a Basic string-variable, MacOS and Windows ?
See :
link text
for a MS-VisualBasic solution.

Following works on windows 8.1, only a few simple changes from the VBA version linked in your question

REM  *****  BASIC  *****

Option Explicit

Sub TestShellRun

	msgbox ShellRun("cmd.exe /c dir")
End Sub

Public Function ShellRun(sCmd As String) As String

    'Run a shell command, returning the output as a string'

    Dim oShell As Object
    oShell = CreateObject("WScript.Shell")

    'run command'
    Dim oExec As Object
    Dim oOutput As Object
    
    oExec = oShell.Exec(sCmd)
    oOutput = oExec.StdOut

    'handle the results as they are written to and read from the StdOut object'
    Dim s As String
    Dim sLine As String
    While Not oOutput.AtEndOfStream
        sLine = oOutput.ReadLine
        If sLine <> "" Then s = s & sLine & chr(10)
    Wend

    ShellRun = s

End Function

How to do the same thing on macOXs

Hi! Is there any way to hide the prompt window?