How can I call a native shell script from a Groovy / Grails Application?
The shell script resides on the same machine.
Put the name (preferably with an absolute path) and the arguments in a list and call execute()
:
['/path/to/script', 'arg1', 'arg2'].execute()
The Groovy documentation suggests to use a simple string instead. I advise against that because it can cause all kinds of problems with special characters, white space in arguments, etc.
You can use the Groosh module (link)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With