Help with how to better construct this message using GLOBAL context

Ok: me being anal, or not. :person_shrugging:

I have this in an exec node:
tail -n11 /media/pi/9020-9C27/events/commands_received.txt | cat
Which is fair enough.

But I also have this in global context:
event_paths as /media/pi/9020-9C27/events/ and
log_paths as /media/pi/9020-9C27/logs/ (Ok not needed here, but....)

So I am wanting to translate the event_paths into the command.

(As best I can explain it showing the structure)

tail -n11 *globalContext_even_paths*commands_received.txt | cat

The nodes:

[{"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"],[],[]]}]

Any ideas please?

Why not construct your command line in a function or template node and pass the whole lot to exec as msg.payload, leaving Command in the exec node blank?

Incidentally, I'm pretty sure that your trailing | cat does nothing useful, though it does no harm either.

1 Like

I guess that would be the simple way.

Thanks.

I seem to have this ability to make simple things difficult for myself more times than I should.

I'll give it a go.