[Solved] Pipe | not working in exec node Raspbian Buster

I'm using the route command to find the gateway IP address if it is up (Flags == "UG")
route --numeric | grep UG

From the command line I get
$ route --numeric | grep "UG"
0.0.0.0 192.168.1.1 0.0.0.0 UG 202 0 0 eth0

When I put the command into an exec node it returns the usage message from route, suggesting that the pipe symbol is being interpreted as a flag rather than constructing the pipeline.
route --numeric without the pipe works fine.

This worked fine on Raspbian Stretch on a Pi 3B

Is this an issue in Node-Red or in Debian?

Hardware: Raspberry Pi 4, Same on Raspberry Pi 3A+
OS: Raspbian GNU/Linux 10 (buster)
node: 10.16.3
Node-RED: 0.20.7

Seems to work for me - Pi4 Buster 1.0 beta 3

[{"id":"d80bce60.0c258","type":"exec","z":"ab4ed7ce.12a608","command":"route --numeric | grep UG","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":530,"y":140,"wires":[["71fa5b8.f8098a4"],["71fa5b8.f8098a4"],["71fa5b8.f8098a4"]]},{"id":"2063baa7.2cd186","type":"inject","z":"ab4ed7ce.12a608","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":140,"wires":[["d80bce60.0c258"]]},{"id":"71fa5b8.f8098a4","type":"debug","z":"ab4ed7ce.12a608","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":810,"y":140,"wires":[]}]

Do you have the append payload option still ticked ?

Append payload wasn't ticked.

I imported cymplecy's code - it works.

Comparing his version and mine in a text file, it seems the significant difference is mine had spawn mode ticked, it works in exec mode.

Surprising because I thought I'd only touched that while trying to diagnose the problem.

Anyway, thanks very much for the help!

2 Likes