i am an absolute newbie in writing bash scripts.
i have a bluetooth temperature sensor, which is connected as a virtual serial device at /dev/rfcomm0. the data comes without a comma, eg. 214 for 21,4 degrees or -125 for minus 12,5 degrees.
after much reading and some useful examples found in the internet, i created the following small bash script :
stty -F $comdevice 19200 -echo
while sleep 60
inputvar=`head $comdevice --lines=1`
this echoes the data, but i have absolutely no idea, how to insert a comma at the last but one position.
i found some code to insert at a specific position using sed, but as the data can be at minimum 2 digits for 6,8 degrees, 3 digits for 21,3 degrees or -4,5 degrees or even 4 digits for -13,7 degrees, i don't know, how to do this.
can someone please help me out here?