EXEC node behaves different than regular terminal

I have noticed before that EXEC node doesn't always behave in the same way as terminal. But this is a particular case

Trying to execute a simple command:
dig -f lista.txt @1.1.1.1 | grep -E '<<>>|status|time'

This command executes dig to a list of URLs contained in a file, and then filter results using grep

When using terminal window the comand works as expected:

; <<>> DiG 9.11.3-1ubuntu1.15-Ubuntu <<>> www.amazon.com
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1599
;; Query time: 37 msec
...

Now, when trying to execute the same command with EXEC node (using same PC):

image

; <<>> DiG 9.11.3-1ubuntu1.15-Ubuntu <<>> 1634871188880 -f lista_url.txt @1.1.1.1
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 45038
;; Query time: 36 msec
; <<>> DiG 9.11.3-1ubuntu1.15-Ubuntu <<>> www.amazon.com
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4334
;; Query time: 58 msec
...

in this case, dig first tries to use the arguments of the command line (and a number which I cannot identify the source) as if they were an URL, then execute the command as expected, reading the URLs from the specified file.

Currently using node-red v2.1.0 and Node.JS v14.18.1

You are injecting msg.payload, uncheck the "append msg.payload"

1 Like

Such a sylly mistake! :blush:

Now it works as expected

Thank you very much

1 Like

It's the number one error that we all make with this node :slight_smile:

The default is now not to append so you have to willfully make it so :slight_smile:

1 Like

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