Is it possible to format the STDERR in order to have a better looking menu using the select command?
I have a simple select
select oChoice in $(<tempMenu.menu) ; do
case "$oChoice" in
*)
break
;;
esac
done
I've tried a trick like:
exec 3>&1
select ...
...
done 2>&1 1>&3 | sed 's/^/NICE OUTPUT /'
But I cannot use escape sequences (i.e. colors), for example
...
done 22>&1 1>&3 | sed 's/^/\033[1;33m\033[44mNICE OUTPUT /'
or
done 22>&1 1>&3 | sed 's/^/\\033[1;33m\\033[44mNICE OUTPUT /'
The escape sequences are not escaped and also the STDOUT is altered because I have customized the PS3 as well.
PS3="$(print \\n\\r)# $(print "\\033[1;33m\\033[44m")"$QUESTION"$(print "\\033[0m\\033[1;1m\\033[44m") `tput sc` $(print "")
#$(print "")
# $(print "")
# Status: $status $(print "")
# $(print "")
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `tput rc` "
As far as I understand (Show only stderr on screen but write both stdout and stderr to file) I cannot separate the STDERR from the STDOUT, so, is there a smarter way to create dynamic text-based menus just using the STDOUT? (or an otherway to workaround my issue)