本文介绍了带有图形菜单的 Bash 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写简单的 bash 脚本已经有一段时间了,我想知道如何实现简单的菜单,如果可能的话,使用带有颜色的菜单.

I have been writing simple bash scripts for a while now, and I was wondering how I could implement simple menus and, if possible, use menus with color.

过去,我编写了使用 ncurses 的简单 C 应用程序,并且希望(如果可能)在我的 bash 脚本中有菜单,用户可以在其中使用向上/向下箭头选择列表中的项目,并通过一系列是/否/取消提示来回/向前.

In the past, I have written simple C applications that use ncurses and would like to (if possible) have menus in my bash script where the user can use the up/down arrows to select items in a list, and go back/forth through a series of yes/no/cancel prompts.

我熟悉在 bash 中设置彩色文本,所以有一个开始(例如:bash 使用颜色),因此此时唯一的要求是查看 bash 是否具有这些功能.我宁愿避免为此用 C/C++ 编写应用程序,因为我希望能够即时编辑它.

I am familiar with setting up colored text in bash, so there's a start (eg: bash using colors), so the only requirement left at this point is to see if bash has these capabilities. I would prefer to avoid having to code an application in C/C++ for this, as I would like to be able to edit it on the fly.

推荐答案

有一个名为 对话框,这与您的要求相关吗?

there is a package called dialog, is this relevant to your requirement?

这篇关于带有图形菜单的 Bash 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 05:37