How to show a GUI message box from a bash script in linux?

前端 未结 13 2181
孤街浪徒
孤街浪徒 2020-12-04 04:58

I\'m writing a few little bash scripts under Ubuntu linux. I want to be able to run them from the GUI without needing a terminal window to enter any input or view any output

13条回答
  •  感情败类
    2020-12-04 05:55

    Here's a little Tcl script that will do what you want. The Wish interpreter should be installed by default on Ubuntu.

    #!/usr/bin/wish
    pack [label .msg -text [lindex $argv 0]]
    pack [entry .ent]
    bind .ent  { puts [.ent get]; destroy . }
    focus .ent
    

    Call it like this:

    myanswer=`gui-prompt "type your answer and press enter"`
    

提交回复
热议问题