I am trying to use shell command notify-send -t 2000 "Title" "Message"
from groovy in next way "notify-send -t 2000 \"Title\" \"Message\"".execute()
and it works perfect.
But when i am trying to put exprsession in place of message it seems nothing works.
here is broken code below:
def todayDate = new Date()
def title = 'Title'
def message = " Message ${todayDate}"
println(title + message)
"notify-send -t 2000 \"${title}\" \"${message}\"".execute()
can you help me with understanding?
Connected to the target VM, address: '127.0.0.1:40305', transport: 'socket' TitleFri May 06 13:41:43 CEST 2016 groovy.lang.MissingPropertyException: No such property: execute for class: DUMMY at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:51) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:295) at DUMMY$_closure1.doCall(DUMMY.groovy:1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:81) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1208) at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1111) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1017) at test.notification.run(notification.groovy:28)'
/notify-send -t 2000 "${title}" "${message}"/.execute()
Also, you don't need to calltoString()
on message. But these are just decorations, what you say you have should work... Capture the output and show what it says