[newbie] Using exec-node with multiple arguments

I'd like to use an exec-node to execute the following command:

ping -c 1 msg.payload[1]

Unfortunately I don't know how to specify msg.payload[1] in the edit window for an exec-node.
The payload of the previous node contains two parts hence I need msg.payload[1] and not msg.payload

Can anyone here tell me how to accomplish this?

kind regards,
Hugo

You cant directly use it but you can put a change node before the exec node configured to set msg.payload to msg.payload[0] than enter only ping -c 1 in the exec node and make sure to check the append msg.payload option.

Johannes

1 Like

Would it make a chance to ask this ( i.e. possibility to use msg.payload[i] in exec node) as a feature request for a future version of Node-Red?
kind regards,
Hugo

You can use the node-red-node-ping node to do single and multiple pings

Triggered mode - this mode permits you to trigger the ping by an input message. If the Target is left blank and msg.payload is a string or array, you can ping 1 or more devices on demand

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.