val String filePath = "/etc/openhab2/scripts/AGVolt-modbus/exported_sum.txt"
val toWrite = Sum1A_value + ", " + Sum1B_value + ", " + Sum2A_value + ", " + Sum2B_value
executeCommandLine("bash -c 'echo \"" + toWrite + "\" >> " + filePath + "'")
logInfo("Export values finished !", "Data written to file: " + toWrite)
no errors but file isn’t created/overwritten ???
Permissions to folder / file “777”
2023-10-25 19:52:11.845 [INFO ] [lipse.smarthome.io.net.exec.ExecUtil] - executed commandLine 'bash -c 'echo "12.08kWh / 0.71e, 71.28kWh / 4.17e, 135.41kWh / 7.92e, 0kWh / 0e" >> /etc/openhab2/scripts/AGVolt-modbus/exported_sum.txt''
2023-10-25 19:52:11.848 [INFO ] [odel.script.Export values finished !] - Data written to file: 12.08kWh / 0.71e, 71.28kWh / 4.17e, 135.41kWh / 7.92e, 0kWh / 0e
cmd line works
echo "Your test string" >> /etc/openhab2/scripts/AGVolt-modbus/exported_sum.txt
Because of OH2 version I’m trying to use @@ to substitute spaces
Rich article
Sorry I don’t have installed exec binding :0)