How can I emulate netcat -e
with a version of netcat that does not have the -e
option ?
I need to trigger a command remotely. I can do it with netcat - without -e
:
#!/bin/bash
netcat -l 8080 ; myCommand.sh
That would do the trick, but I would like to reply to the client depending on the success or failure of the command (to have a kind of REST - like interface).
How could I do that ?
Thanks!
mkfifo foo
nc -lk 2600 0<foo | /bin/bash 1>foo
Then just nc servername 2600 and ./script.sh
kill the client with ctrl+c