Srinath
Srinath

Reputation: 1343

shell command in groovy

How to run this command in groovy :

/home/srinath/junk/sync.sh > /home/srinath/junk/copy.log

This is working when tried on terminal . but fails when used execute in groovy

Could any one please help me on this .

thanks in advance
sri..

Upvotes: 0

Views: 459

Answers (1)

tim_yates
tim_yates

Reputation: 171194

Shell based redirection and piping doesn't work from inside the JVM without a bit of data handling

For this example, you should be able to do:

new File( '/home/srinath/junk/copy.log' ).write( '/home/srinath/junk/sync.sh'.execute().text )

Upvotes: 1

Related Questions