executing shell script and using its output as input to next gradle task
<p>I am using gradle for build and release, so my gradle script executes a shell script. The shell script outputs an ip address which has to be provided as an input to my next gradle ssh task. I am able to get the output and print on the console but not able to use this output as an input to next task.</p>

<pre><code>remotes {
  web01 {
    def ip = exec {
    commandLine './returnid.sh'
    }
    println ip  --&gt; i am able to see the ip address on console
    role 'webServers'
    host = ip  --&gt; i tried referring as $ip '$ip' , both results into syntax error
    user = 'ubuntu'
    password = 'ubuntu'
  }
}

task checkWebServers1 &lt;&lt; {

  ssh.run {
    session(remotes.web01) {
    execute 'mkdir -p /home/ubuntu/abc3'
}
}
}
</code></pre>

<p>but it results in error "</p>

<pre><code>What went wrong:
Execution failed for task ':checkWebServers1'.
 java.net.UnknownHostException: {exitValue=0, failure=null}"
</code></pre>

<p>Can  anyone please help me use the output variable in proper syntax or provide some hints which could help me.</p>

<p>Thanks in advance</p>