Script through exec in openhab2

I am able to run a command through exec below is the thing and item


Thing exec:command:demo [command="echo hai", interval=15, timeout=5]


String Mydemo "[%s]" (All) {channel="exec:command:demo:output"} 

Now i want to run a script which prints numbers starts with 1 for that i have configured my thing as

Thing exec:command:demo [command="/etc/openhab2/", interval=15, timeout=5]

But im nt able to see the numbers in log. Hw to configure a thing for a script?

What is the content of your script
Is it executable and does it work if you run it direct from the shell?

There are also channels available on the Thing you can attach some Items to and see the likes of ‘Exit Value’.

Unless you put the exec binding into TRACE logging you won’t see anything in the log. You should create a Rule that triggers when Mydemo receives an update and logInfo the state of Mydemo.