I am struggling to pass a parameter via executeCommandLine to an .sh script.
This way I am calling my .sh scripts:
val result = executeCommandLine(Duration.ofSeconds(10), path)
Where do I have to put my parameters and how do I call them within the .sh script?
I tried things like:
val result = executeCommandLine(Duration.ofSeconds(10), path, parameter)
or
val result = executeCommandLine(Duration.ofSeconds(10), "path/script.sh parameter")
But am not able to call the parameter via $1 within the script. Any help greatly appreciated!
These are my entries in a rule file:
executeCommandLine( Duration.ofSeconds(5), β/etc/openhab/scripts/light.shβ, βOUT4β, β1β )
executeCommandLine( Duration.ofSeconds(5), β/etc/openhab/scripts/light.shβ, βOUT4β, β0β )
This is content of the above script:
#!/bin/bash
switch=$1
OnOff=$2
If that does not work for you:
check if the script is executable and readable
add e.g. echo abc > /tmp/debug.txt to your script to check if it is executed
add e.g. $OnOff >> /tmp/debug.txt to your script ( adapted to your variable name ) to check if content is passed to the script
It does not work because of the single quotes around $1. $1 then is not replace with itβs content but used literally.
Replace β with " and use " instead of " inside -d.