如何执行对话命令,并使其返回原始屏幕? [英] How to to execute a dialog command, and have it return to the original screen?

查看:91
本文介绍了如何执行对话命令,并使其返回原始屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新手在这里,不确定如何问这个问题.

Newbie here, not sure how to ask this.

执行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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆