0
For a single script redirecting stdout and stderr to a file with this:
./myscript.sh 2>&1 | tee -a out_file
works fine. When I try to run the same way a script containing multiple dialog boxes created with dialog command (and calling other scripts)
./main.sh 2>&1 | tee -a out_file
the out_file contains unwanted characters due to these boxes. For example:
#!/bin/bash
# myscript.sh
dialog --title "Title" \
--msgbox "Message Box" \
30 120
date
generates with:
$ ./myscript.sh 2>&1 | tee -a myscript.out
multiple lines similar to this one:
[36m[44m [30m[40m[K[22;38H[39;49m(B[m[2;3H[30m[47mMessage Box[22;38H[39;49m(B[m
How can I get stdout and stderr without these characters (for main and all subsequent scripts)? That would be in the example the output of date. Nice to have would be what a user has entered in an inputbox.
you could use tr to get rid of it like
tr -d 'ﮛ'
so maybe like./main.sh 2>&1 | tr -d 'ﮛ' | tee -a out_file
– barlop – 2018-04-06T17:55:42.237We need details of the scripts and the unwanted characters. Please expand your question to include them. – AFH – 2018-04-06T18:00:16.733
Try using dialog --stdout option,
dialog --stdout ...
– Paulo – 2018-04-07T05:15:24.247