How to start another dialog on top of the running dialog there is an option --add-widget "token"?

Continue to write your script to automatically install one distribution. Decided to replace a sequence of instructions with an invitation to enter into dialog using dialog.

Since this installation script, that I thought I need a nice progress bar. Decided to use --gauge.
I decided that all the time the installation progress bar should be in the background, yet the time will appear dialog like yes/no, or invitation to enter a username, for example.
So, I issued this:
spoiler
while [[ $i < 101 ]]
do
 #some code
 echo $((++i))
 dialog --yesno text 50 50
 #some code
 echo $((++i))
done | dialog --title 'Test script' --gauge 'Running...' 6 60 0

1. That is, after each executed command for the progress bar should be added conditionally 1%.
2. In the background should be easy to run the install command is not outputting anything to the console.
3. Also had to display the dialog box, but with this challenge, as I have said above, the progress bar just freezes, and when you click on Enter, it becomes active again (obviously, a new window is invisible, but interactively).
Tried various bundles with --no-kill, --keep-window --clear. Seems like nothing helped.
When a bunch of dialog boxes in the chain via --and-widget, everything works fine, but then there are two problems:
1) the Windows are launched one after another. That is, next window starts after the completion of the last (the progress bar in my case).
2) it is Not clear how then to add interest.

Maybe describe a bit messy, but seems clearly described the task. The main thing to solve the problem.

Thanks in advance for your help.
April 7th 20 at 10:45
1 answer
April 7th 20 at 10:47
Solution
Fun utility, really is a lot to do with it.
For a start, the variable i you have the text, and "$i < 101" does not work correctly. Declare it as a number and then $i -lt 101
well approximately distribute what you want
declare-i i
while [[ $i -lt 101 ]]
do
 sleep 1
 echo $i| dialog --keep-window --begin 1 1 --gauge 'Running...' 15 $15 and i --and-widget --yesno text 50 50
i+=1
done
A cunning solution. Each time will be called a new dialogue and drawn exactly in the same place as the last one. If he has not been restarted.

There was only one question,
echo $i | dialog ...
need to "close" the progress bar shows the next widget? Without it does not work, but I don't understand its meaning. We pass the value of the variable i to progress bar, it takes it and makes the current value of the interest.... moreover, the call ProgressBar we also specify that its starting value, with interest equals $i...
Can you explain, please? - nestor5 commented on April 7th 20 at 10:50
I've no idea, I hastily watched while writing, I forgot that I $i already point at the end of the gauge ;)
try to remove the "echo $i |" all =)

Wait, I remember.
in the instructions for dialog --gauge says that it is waiting for something from stdin, it is est he needs something to throw. I throw $i - alisa61 commented on April 7th 20 at 10:53

Find more questions by tags LinuxbashArch Linux