N
N
nobody way2020-02-09 02:15:45
linux
nobody way, 2020-02-09 02:15:45

How to launch another dialog, on top of a running dialog that is missing the --add-widget token?

I continue to write my script for the automatic installation of one distribution kit. I decided to replace the sequence of commands with an input prompt with dialog boxes using the dialog program .

Since this is an installation script, I thought that a beautiful progress bar is needed. Decided to use --gauge .
I decided that during the installation the progress bar should be in the background, while in the meantime dialog boxes like yes / no or prompts for entering a username, for example, will appear.
So, I made it like this:

spoiler
while 
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, conditionally 1% should be added to the progress bar .
2. At the same time, the installation commands should be quietly executed in the background, without outputting anything to the console.
3. Dialog boxes should also be displayed , but with such a call, as I indicated above, the progress bar simply freezes, and when you click on Enter, it becomes active again (obviously, the new window is invisible, but interactive).
Tried various bundles with --no-kill, --keep-window, --clear . It seems like nothing helped.
When chaining dialog boxes with --and-widget everything works fine, but then there are two problems:
1) Windows are launched one by one. That is, the next window in the chain will start after the completion of the last one (the progress of the bar in my case).
2) It is not clear how then to add a percentage.

Perhaps described a little chaotically, but it seems to have clearly described the task. The main thing is to solve the problem.

Thanks in advance for your help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2020-02-09
@Mogekoff

A funny utility, you can really do a lot of things with it.
For starters, the i variable is text, and "$i < 101" doesn't work correctly. Declare it as a number and then $i -lt 101
well, roughly threw what you want

declare -i i
while 
do
    sleep 1
    echo $i| dialog --keep-window --begin 1 1 --gauge 'Running...' 15 15 $i --and-widget --yesno text 50 50
    i+=1
done

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question