How do i replace the \r?
#!/bin/bash
...
# setup
if [[ $i =~ $screen ]]; then
ORIGINAL=${BASH_REMATCH[1]} # original value is: 3DROTATE\r
AFTER =${ORIGINAL/\\r/} # does not replace \r
myThirdPartyApplication -o $replvar # FAILS because of \r
fi
This should remove the first \r.
AFTER="${ORIGINAL/$'\r'/}"
If you need to remove all of them use ${ORIGINAL//$'\r'/}