How to call a function with parameter in a bash script?

What is the easiest way to create a GUI for a bash script that takes multiple text inputs at the same time?

  • I have some bash script to create a simple verification test-bench which takes some argument like agent name, driver name, sequencer name etc. Now I want to create a gui for this bash script in which there will be some button like create or add, some text boxes to write parameter (i.e. agent class name, agent name ) which will then assign as the input parameter for that bash script. I am a complete novice in GUI design. So I am looking for some software that can create a gui by using drag and drop. Also I will be needed some tutorial to understand how to add my bash script with this GUI.

  • Answer:

    If you are looking for UI programming in command line itself, then the answer to be looking for is using ncurses. For reference (and even re-use) you can see the Linux kernel build configuration system 'menuconfig' . It uses the ncurses library based implementation present in kernel code itself (under scripts/kconfig/) to draw UI, provide user input dialog etc. Edit #2: For creating a full fledged separate UI, with dialog are the usual requirements & still not sacrificing on flexibility of scripting would be to use scripting languages such as python(using http://www.wxpython.org/ , you create quite some intuitive User Interfaces). P.S: Using python and wxpython is something just popped in to my mind, in fact there are quite a lot of tools & scripting languages out there which will serve the same purpose.

Vaisakh Sudheesh at Quora Visit the source

Was this solution helpful to you?

Other answers

In addition to python with wxpython there is also Python/Tk and Tcl/Tk. Tcl/Tk is arguably much more bash like than Python is. Neither is really bash though. Tcl/Tk has an extensive series of gui popup tools, both built-in and via extensions like this one: http://wiki.tcl.tk/8309 If you really want it to just be in your terminal window (more of an enhanced CLI than a GUI), then ncurses or something that uses ncurses is probably your answer. search for the 'Dialog' package. It might be just what you are looking for.

Doug Hughes

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.