How to "not clear" the screen when using dialog?
2
votes
1
answer
1282
views
dialog
is a great tool but I can't find a way to use it in a bash script where it would NOT clear the screen beforehand.
I know this is possible if I use --keep-window
in conjunction with --and-widget
but in this case I cannot process the user input before displaying the next dialog.
Is it possible to launch a dialog
command and having it draw its window without clearing the screen ? Is there some trick I'm not aware of ?
**EDIT** (clarification):
Here's a simplified example script of what I'd like to achieve (no, I'm not trying to write a game in bash ;) ): the user input from the first dialog is important to the script and is saved in the variable selection
The second dialog should then be displayed in front of the first one. But calling dialog
automatically clears the screen (and so the first dialog has disappeared)
#!/bin/bash
# selection will contain the "tag" of the option selected, either 1, 2 or 3
selection=$(dialog --output-fd 1 --menu "Which cup will you choose ?" 0 0 0 1 "A simple wooden bowl" 2 "A golden jeweled cup" 3 "A plastic goblet")
# and now a second dialog that I'd like to show in front of the first one without clearing the screen
case $selection in
1)
dialog --msgbox "You have chosen ... wisely." 0 0
;;
2)
dialog --msgbox "You chose ... poorly" 0 0
;;
3)
dialog --msgbox "You must be kidding right ?" 0 0
;;
*)
dialog --msgbox "You have to choose one !" 0 0
;;
esac
Asked by fvlinden
(129 rep)
Feb 8, 2022, 10:30 AM
Last activity: Feb 17, 2023, 02:58 PM
Last activity: Feb 17, 2023, 02:58 PM