shell script with parameters

i’ve gut a function which starts the terminal app and opens a ssh tunnel:

Public Sub sshClientConnect(user as string,ip as string) dim s as new shell dim a as String s.Execute("osascript -e 'tell application ""Terminal""' -e Activate -e 'do script ""ssh "+user+"@"+ip+"""' -e 'end tell'") End Sub
which works fine.
Now i want to execute this from xojo (which works if i execute it from the terminal):

ssh imagica@ “/cygdrive/c/cygwin64/home/imagica/paexec.exe -d -dfr -i 1 -s ‘c:\Program Files (x86)\test\Watchdog.exe’”

how can i integrate the bold part after the ip address into me xojo code above? I am struggling with the quotes i think…


The easiest way would be to put the entire string in a constant and use that.

dim cmd as string = kOsaCommand
cmd = cmd.ReplaceAllB( "%USER%", user )
cmd = cmd.ReplaceAllB( "%IP%", ip )
s.Execute cmd

Constant kOsaCommand As String
  osascript -e 'tell application ...' -e Activate -e 'do script "ssh %USER%@%IP%"' ...

BTW, there should be no need to open a Terminal window for this. You should be able to use an Interactive shell that you just keep active, unless there is some other reason for Terminal.