Consider this short program:#!/bin/bashARDUINO_SERIAL=arduino-serial/arduino-serialPORT=/dev/cu.usbmodem1421VERS=$($ARDUINO_SERIAL -q -b 9600 -p $PORT -S 'V' -e '\r' -r)echo --- VERS = $VERSB=hello${VERS}goodbyeecho --- B = $BFWIW, arduino-serial is a program that sends a string to an external arduino and echoes its response to stdout.So I would expect this little script to produce:--- VERS = 00.01--- B = hello00.01goodbyebut instead it's producing--- VERS = 00.01goodbyeI don't understand how the prefix string --- B = hello00.01 is getting eaten rather than echoed.Can someone explain what's going on and how to fix this?
bash is eating my string
bash;shell script;echo