PDA

View Full Version : Reset background color for bash dialog?



CrewDK
June 17th, 2016, 03:04 PM
Hey.

I got some script where i'm useing dialog command.


#!/bin/bash

tmpfile=$(mktemp tmp.XXXXXXX --tmpdir=/tmp 2>/dev/null) || tmpfile=/tmp/test$$

dialog --backtitle "Конфигурация сервера" \
--title "Установка" \
--clear \
--checklist "Список заданий" 15 50 4 \
1 "Install LAMP" on \
2 "Setup IPTABLES" on 2> ${tmpfile}

if [ "$?" -eq "0" ]; then

grep -o 1 $tmpfile > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo 123
fi


grep -o 2 $tmpfile > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo 123
fi

else

echo "Interrupted"

fi


Is there any way to reset background and font colours back to default black\white after filling dialog "form"? I tried to use "clear" but it's no use. :(

Habitual
June 17th, 2016, 04:15 PM
Background color of the dialog or the terminal after the dialog/script exits?
And running your script, selections are both pre-filled. Both chosen.

CrewDK
June 17th, 2016, 11:43 PM
I'm talking about blue BG color. For example, i want to see some output after running dialog and this blue BG a little bit noisy :(
Is there any way after close dialog form itself reset this colours back to default?

Skaperen
June 19th, 2016, 02:35 AM
what did the clear command do? the dialog man page says that is what to do. maybe your terminal was not set to the default colors. try clear by itself and tell us what happens. what terminal are you running? maybe setterm can do what you need.

Habitual
June 19th, 2016, 01:52 PM
clear or reset command.

CrewDK
June 20th, 2016, 04:19 AM
Yeah. I know about clear, but some strange way when I run this script in ssh session it looks for me like this. If i run this script in real terminal - all works just fine. So what wrong with ssh session or what?

CrewDK
June 20th, 2016, 04:29 AM
what terminal are you running? maybe setterm can do what you need.

How can I check what terminal i'm running? Sorry i'm still not so good with linux :) Are you talking about that?

http://crewdk.ru/fscapture/2016-06-20_062634.jpg

I tried use setterm with --default and --reset but this didn't helped me :(

Skaperen
June 20th, 2016, 04:43 AM
it look like you are running putty. maybe it is emulating a terminal wrong. install ubuntu (in a virtual machine) and use that

CrewDK
June 20th, 2016, 05:15 AM
I'm running "Xshell". This is too ssh client for windows PCs. And as I already told - when I'm running this script in "real" terminal (yeah, on virtual machine) - all works fine. So maybe some one have any idea what setting for ssh client I should look for?

Skaperen
June 24th, 2016, 05:28 AM
welcome to the world of "compatibility" with Windows stuff.