问题
Newbie here, not sure how to ask this.
Short version
What is the trick to execute a shell command, upon finishing, it will return to the original screen?
Long version
I am wring a shell script using dialog
, say it will open a console based UI, then when I exit it, it will looks like:
$ ./run_a_script_containing_dialog.sh
++++++++++++++++++++++++++++++++++++++
+.......
++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++
++++++ A BLUE BACKGROUND DIALOG ++++++
++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++
+.......
++++++++++++++++++++++++++++++++++++++
$ (Upon finishing, prompt would be here)
What I really want is this:
$ ./run_a_script_containing_dialog.sh
$ (Dialog is still opened as normal, but upon finishing, prompt would be here)
I'd like to see a kind of behavior just like what we typically see in using man
, when you press q
, it will return to your original screen.
Another version
PS: Please forgive me if you think the solution of this would be totally different than the above.
How to write a shell script to achieve this effect? Let's say this script will just simply list the files in the current folder, but it will list them in a new screen.
$ ./a_personal_ls.sh (a new screen will open and list the files in $PWD)
$ (Pressing `q` will cause the new screen disappear, and prompt will be here)
Is this doable in shell scripting?
回答1:
Try passing the somewhat confusingly named --keep-tite
option to dialog
(as the first option).
来源:https://stackoverflow.com/questions/24003364/how-to-to-execute-a-dialog-command-and-have-it-return-to-the-original-screen