groovyshputty

Groovy script pass value to sh. script


I have to make Groovy Test Step in SOAPUI which pass variables to sh script and then run it in putty.

I have created this simple Groovy script:

def command = "C:/path/to/putty.exe -ssh user@IP -pw pass -m 
local_command_file.sh"
def proc = command.execute()
proc.waitFor()

and this sh script:

#!/bin/bash

sleep 2
grep '$VARIABLE' /path/to/log/file.log
sleep 10​

Is there any way to define $VARIABLE in Groovy script and then get the value to sh script?

Thanks


Solution

  • After reading resolutions from links you commented here I decided to create sh. file on the fly.

    Thanks to everyone