#!/bin/bash

TTY_DEV=$1 # or /dev/ttyACM1
OUT_FILE=$2

if [ -z "$TTY_DEV" ];
then
  TTY_DEV=/dev/ttyACM1
fi

if [ -z "$OUT_FILE" ];
then
  OUT_FILE="tty_bootup_seq.log"
fi

echo "Read from "$TTY_DEV" and write to "$OUT_FILE

while read line; do
     if [ "$line" != "EOF" ]; then
          echo "$line" >> $OUT_FILE
     else
          break
     fi
done < $TTY_DEV

