Ok, expansion on things.
Here is another (sorry) bit of the code.
[{"id":"74647831.e6bf18","type":"inject","z":"a3bd09a.b852978","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":310,"y":210,"wires":[["88ec09d0.6e1c28"]]},{"id":"88ec09d0.6e1c28","type":"exec","z":"a3bd09a.b852978","command":"ls -1 --file-type /media/pi/9020-9C27/logs/reboot/ | grep -v '/' | sed s/@$// | cat","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Cat","x":470,"y":210,"wires":[["17917965.d43657","87a8c9d9.4f7f58"],[],[]]},{"id":"17917965.d43657","type":"split","z":"a3bd09a.b852978","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":670,"y":200,"wires":[["f8e85ffb.27a12","a2f4ed08.9b76d"]]},{"id":"a2f4ed08.9b76d","type":"debug","z":"a3bd09a.b852978","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":840,"y":200,"wires":[]},{"id":"f416f19bd14acba1","type":"inject","z":"a3bd09a.b852978","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1010,"y":140,"wires":[["3b8e8db1663c4cfe"]]},{"id":"3b8e8db1663c4cfe","type":"change","z":"a3bd09a.b852978","name":"command","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"ls -1 --file-type \" & $globalContext(\"reboot\") & \" | grep -v '/' | sed s/@$// | cat\"\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1180,"y":140,"wires":[["f84266302b2910d0"]]},{"id":"f84266302b2910d0","type":"exec","z":"a3bd09a.b852978","command":"","addpay":"payload","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":1400,"y":140,"wires":[["17917965.d43657"],[],[]]}]
Desired.
What the new code gives me.
I'll see if I can work out where the problem is.
I'm guessing it is getting a list of all files rather than the one I want.
AH!
Removing the wire between the change and the exec node (on the right) and replacing it with a debug I get this strange output:
But the original command in theoriginal exec node is this command:
ls -1 --file-type /media/pi/9020-9C27/logs/reboot/ | grep -v '/' | sed s/@$// | cat
Slight difference.
Confused.
Ah2!
Is this this what should be in the change node?
"ls -1 --file-type " & $globalContext("log_path") & "reboot | grep -v '/' | sed s/@$// | cat"
That seems to be giving me the expected result.
RESOLVED!
Thanks folks.