'Garbage Characters Appearing at Beginning of Output in Whiptail Textbox
I have a function block that runs an Expect script, pulls the output, tweaks it through a combination of tr and grep to pull out the specific line of text I am looking for and then displays the text in a Whiptail textbox. Everything works fine except the beginning of the output in the textbox; it contains characters that are not in the actual variable that is being outputted.
The function block I have is:
do_view_URL() {
NODE="$PROPERTY_IP""$TOTE_BOARD_IP"
OUTPUT=""
OUTPUT=$(/usr/bin/expect /home/pi/ssh_tote_board_url_grab.sh $NODE)
CURRENT_URL=$(echo $OUTPUT | tr -d '\r' | tr ' ' '\n' | grep https: | head -1)
echo $CURRENT_URL
echo $CURRENT_URL > ./textbox_file
whiptail --title "Current Production URL for Tote Board #$TOTE_BOARD_NUM" --textbox ./textbox_file 10 150
}
The Whiptail textbox output looks like this:
At the beginning of the output, the following characters appear; the characters are always the same no matter how many times I run the script:
^[[?2004l
As you can see in the function block, I am also outputting the value of "CURRENT_URL" to the CLI. The results of that as well as a cat of the ./textbox_file are as follows; clearly the garbage characters do not appear in either the echo output or the cat output:
pi@XXXXXX:~ $ ./tote_board_updater.sh
https://<REMOVED>
pi@XXXXXX:~ $ cat ./textbox_file
https://<REMOVED>
pi@XXXXXX:~ $
Any help, assistance, or guidance as to where these characters could be coming from and how I can get rid of them in the output so that the end result is that the output is just the full URL would be greatly appreciated. Thank you in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
