1 #!/bin/sh 2 3 usage() { 4 ( 5 echo "Usage: $0 [board IP] [board port]" 6 echo "" 7 echo "If IP is not specified, 'localhost' will be used" 8 echo "If port is not specified, '2001' will be used" 9 [ -z "$*" ] && exit 0 10 echo "" 11 echo "ERROR: $*" 12 exit 1 13 ) 1>&2 14 exit $? 15 } 16 17 while [ -n "$1" ] ; do 18 case $1 in 19 -h|--help) usage;; 20 --) break;; 21 -*) usage "Invalid option $1";; 22 *) break;; 23 esac 24 shift 25 done 26 27 ip=${1:-localhost} 28 port=${2:-2001} 29 30 if [ -z "${ip}" ] || [ -n "$3" ] ; then 31 usage "Invalid number of arguments" 32 fi 33 34 trap "stty icanon echo opost intr ^C" 0 2 3 5 10 13 15 35 echo "NOTE: the interrupt signal (normally ^C) has been remapped to ^T" 36 37 stty -icanon -echo -opost intr ^T 38 nc ${ip} ${port} 39 exit 0 40