Is it possible to make the script run when it shifts from normal mode to the interactive mode.
#/bash/bin
sudo gatttool -b 80:EA:CA:00:00:03 -I
# All these commands are typed in interactive mode
connect
while [ 1 ]; do
char_read_hnd 0x0030 > a.txt
done
exit 1