如何执行对话命令,并让它回到原来的屏幕? [英] How to to execute a dialog command, and have it return to the original screen?
问题描述
新手,不知道怎么问.
shell命令执行的技巧是什么,执行完会回到原来的屏幕?
What is the trick to execute a shell command, upon finishing, it will return to the original screen?
我正在使用 dialog
编写一个 shell 脚本,说它会打开一个基于控制台的 UI,然后当我退出它时,它看起来像:
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)
我真正想要的是:
$ ./run_a_script_containing_dialog.sh
$ (Dialog is still opened as normal, but upon finishing, prompt would be here)
我希望看到一种行为,就像我们通常在使用 man
时看到的那样,当您按 q
时,它会返回到您的原始屏幕.
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.
PS:如果您认为这个解决方案与上面的完全不同,请原谅我.
如何写一个shell脚本来实现这个效果?假设这个脚本只是简单地列出当前文件夹中的文件,但它会在新屏幕中列出它们.
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)
这在 shell 脚本中可行吗?
Is this doable in shell scripting?
推荐答案
尝试将名称有点混乱的 --keep-tite
选项传递给 dialog
(作为第一个选项).
Try passing the somewhat confusingly named --keep-tite
option to dialog
(as the first option).
这篇关于如何执行对话命令,并让它回到原来的屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!