I
I
Ivan Eliseev2017-03-15 17:08:42
linux
Ivan Eliseev, 2017-03-15 17:08:42

How to normalize the output of a dialog box that is used in a bash script?

Hello. I am writing an installation script, in general, it even works out :))
I decided to use "dialog" to configure the installation and ask questions to the user.
But it is displayed with some kind of terrible hieroglyphs. How exactly, on the screen.
Can this be fixed?
upd: Of
course, I will show the code )))
Understand and forgive me, I've been studying bash for the second hour with foam from the mouth, I'm too fired up :D

#!/bin/bash
DIALOG=${DIALOG=dialog}

$DIALOG --title " заголовок " --clear \
        --yesno "крякозябры" 10 40

case $? in
    0)
        echo "Выбрано 'Да'.";;
    1)
        echo "Выбрано 'Нет'.";;
    255)
        echo "Нажата клавиша ESC.";;
esac

#!/bin/bash
DIALOG=${DIALOG=dialog}
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
trap "rm -f $tempfile" 0 1 2 5 15

$DIALOG --title " Окно ввода данных " --clear \
        --inputbox "А когда пилю окно ввода данных, вообще какой-то ужас получается:" 16 51 2> $tempfile

retval=$?

case $retval in
  0)
    echo "Вы ввели `cat $tempfile`"
    ;;
  1)
    echo "Отказ от ввода.";;
  255)
    if test -s $tempfile ; then
      cat $tempfile
    else
      echo "Нажата клавиша ESC."
    fi
    ;;
esac
clear

18777a364c0640a6a46d9932d6171fb5.pngb21a4839a51e40d3a6797dad5bbc2b9e.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2017-03-15
@ivaneliseeff

Most likely you are looking at the menu through some crooked terminal, perhaps putty. Add a parameter to the dialog call --ascii-lines- it will be better

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question