Hello maybe someone can help me with an executeCommandLine() that includes a redirect to store the scanned picture in a file and not the terminal
This is my rule:
when
Item Scanning changed to ON
then
var String print = "/usr/bin/sudo@@/usr/bin/scanimage@@--resolution=150@@--format=tiff@@>/media/scan/scan_$(/bin/date +%Y%m%d_%H%M%S).tiff"
logInfo("debug",print)
var String answer = executeCommandLine(print,30000)
logInfo("debug",answer)
postUpdate(Scanning, OFF)
end
This is the outcome:
2017-07-25 08:56:43.812 [INFO ] [eclipse.smarthome.model.script.debug] - scanimage: argument without option: `>/media/scan/scan_$(/bin/date +%Y%m%d_%H%M%S).tiff'; try scanimage --help
So the String looks good, but the redirect bit is not recognized as part of the command.
Leaving out the @@ separators:
leads to
2017-07-25 09:17:09.908 [INFO ] [eclipse.smarthome.model.script.debug] - scanimage: argument without option: `+%Y%m%d_%H%M%S).tiff'; try scanimage --help
but the free space between “date” and “+%Y%m%d_%H%M%S” is needed.
This for example starts scanning but ignores the redirect and prints the file to the CLI
`````var String print = “/usr/bin/sudo@@/usr/bin/scanimage@@–resolution=150@@–format=tiff>/media/scan/scan_$(/bin/date +%Y%m%d_%H%M%S).tiff”````
I really tried countless combination, can somebody help me?
Thanks a lot.