#!/bin/bash if [ -s "$TMP" ]; then binSRC=$( cat "$TMP" | grep Linking | sed -e 's/Linking //g' ) cp "$binSRC" . serialPort=$(cat "$TMP" | grep "opening port" | awk '{split($0,a," "); print a[3]}') else serialPort=/dev/ttyUSB0 fi echo "Serial: $serialPort" if cat "$TMP" | grep -q 'error'; then echo "exit" else if [ "$1" != "noserial" ]; then echo "Connecting $serialPort" stty -F $serialPort cs8 cstopb -ixon raw speed 115200 while [ 1 ]; do cat $serialPort sleep 1 done else echo "Serial terminal omited" fi fi