串口与网络IP、端口号完成映射的脚本。希望对大家有帮助
[root@localhost bash_doc]# cat ./ttyusb.sh #!/bin/bash TCP_PORT=5021 SERIAL_PORT=/dev/ttyUSB0 BAUDRATE=9600 while (true) do stty -F $SERIAL_PORT $BAUDRATE stty -F $SERIAL_PORT line 0 stty -F $SERIAL_PORT eof ^A stty -F $SERIAL_PORT min 1 stty -F $SERIAL_PORT time 0 stty -F $SERIAL_PORT -brkint stty -F $SERIAL_PORT -icrnl stty -F $SERIAL_PORT ixoff stty -F $SERIAL_PORT -imaxbel stty -F $SERIAL_PORT -opost stty -F $SERIAL_PORT -onlcr stty -F $SERIAL_PORT -isig stty -F $SERIAL_PORT -icanon stty -F $SERIAL_PORT -iexten stty -F $SERIAL_PORT -echo stty -F $SERIAL_PORT -echoe stty -F $SERIAL_PORT -echok stty -F $SERIAL_PORT -echoctl stty -F $SERIAL_PORT -echoke nc -l 192.168.1.33 $TCP_PORT < $SERIAL_PORT > $SERIAL_PORT done