i run node-red on a IOT2000 module from Siemens.
I need to mount a shared folder from windows.
It works if I do it with Putty (command promp).
I send: mount.cifs //192.168.1.58/Share /Recepten –o user=Iedereen
Then I get back : Password for root@192.168.1.58/Share:
Since I don't have a password I just pres [enter] and it works.
Now I have to do this with node-red (so I can do it automaticly evertytime it boot up)
I can send the first command: mount.cifs //192.168.1.58/Share /Recepten –o user=Iedereen
But then I get back: Password for root@192.168.1.58/Share:
But how I need to answer on this? Do I need two exec nodes?
I don't know how to deal with this in node-red
that may work - or the enter may get sent too quick...
The node-red-node-daemon node could be an alternative as that leaves the input side open for use as stdin so you can inject extra commands into the process at any time.
A different solution, for future readers finding this topic, would be to use expect and a script for it. I use it to insert non-empty passwords into processes without having to store the passwords in plain text in scripts or flows. This article is how I got started with expect: https://likegeeks.com/expect-command/
Does the job for me wherever I need it to. This situation is slightly easier so echo | ... works just fine too.
echo {something} | command - will pipe "something" into the command... and automatically adds an enter - so echo | will just send enter to the command. As long as that is all you needed then phew... anything more complex than a single word plus enter then use the expect command/script as suggested by @afelix