#!/bin/bash stty -echo dmesg -n 1 function chksum (){ echo -n "$1" | md5sum | awk '{print $1}' } function tx_data (){ File="$1" if [ ! -f $File ] ; then echo "File $File not found." fi md5sum $File | awk '{print $1}' cat $File | base64 | while read -r x ; do Sum=$(chksum "$x") while true ; do # Send the data echo "$x:$Sum" read X < /dev/ttyS0 X=$(echo "$X" | tr -d '\n') if [[ "$X" == "$1" ]] ; then break elif [[ "$X" == "quit" ]] ; then exit fi done done echo "EOF" } tx_data $@