I think that I have found an answer myself. I looked a bit inside the source code of ExecuteCommandLine which essentially uses the JAVA command "Runtime.getRuntime().exec" to execute the string in the shell.
Google came up with the following post when it came to "Runtime.getRuntime().exec" and "escape characters":
http://stackoverflow.com/questions/5969724/java-runtime-exec-fails-to-escape-characters-properlyIn talks about passing a "string [] array" instead of a "string" to pass a command and its parameters. This rang a bell, because the ExecuteCommandLine code speaks of a "@@" delimiter:
* Executes <code>commandLine</code>. Sometimes (especially observed on
* MacOS) the commandLine isn't executed properly. In that cases another
* exec-method is to be used. To accomplish this please use the special
* delimiter '<code>@@</code>'. If <code>commandLine</code> contains this
* delimiter it is split into a String[] array and the special exec-method
* is used
Therefore, I tested the following code in my rule and it works fine:
executeCommandLine("pluma@@/etc/init.d/openhab")The resulting logfile shows:
2015-01-23 22:30:21.620 [INFO ] [g.openhab.io.net.exec.ExecUtil] - executed commandLine '[pluma, /etc/init.d/openhab]'Eventually, this allowed me to successfully pass the more complicated command to send a WhatsApp message:
executeCommandLine("/opt/yowsup-master/yowsup-cli@@demos@@-s@@49xxxxxxxxxx@@Yoh! What's up?@@-c@@/opt/yowsup-master/config.yowsup")Logfile output:
2015-01-23 22:51:43.183 [INFO ] [g.openhab.io.net.exec.ExecUtil] - executed commandLine '[/opt/yowsup-master/yowsup-cli, demos, -s, 49xxxxxxxxxx, Yoh! What's up?, -c, /opt/yowsup-master/config.yowsup]'It is the equivalent of the following command line (which absolutely requires double-quotes in command line to indicate the "text message"):
/opt/yowsup-master/yowsup-cli demos -s 49xxxxxxxxxx "Yoh! What's up?" -c /opt/yowsup-master/config.yowsup