Reputation: 59
I'd like the terminal to return to normal after the bash script has been executed.
#! /bin/bash
echo -ne "\x01\x02\x00\x00\x00\x06\x01\x05\x00\x00\x00\x00" |nc 192.168.0.119 502 > /home/pi/mb.txt
exit 0
Currently, the script runs as expected and the output goes to its destination, but the terminal then hangs after running ./script
, waiting for me to hit CTRL-C. I'd like the terminal to return to normal right after the script has run.
Upvotes: 0
Views: 231
Reputation: 359965
nc -N 192.168.0.119 502
From the man page:
-N
shutdown(2) the network socket after EOF on the input. Some servers require this to finish their work.
Note that this may not be available in some versions.
Upvotes: 2