Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
549 views
in Technique[技术] by (71.8m points)

user interface - Dialog from bash script

I want create a simple graphical (Qt, Gtk, ...) dialog, concretly a simple print dialog, as a "frontend" to lpr, in bash. What I want? How many pages per page, printing interval. It's (at least) two options.

What is the best util(s) to solve this problem?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is

Other implementations are reported to exist:

If you use gpm, you can even use the mouse in a console environment. It requires a tty, so it will work over ssh, screen, xterm etc. but not when piping/redirecting.

Both sport more or less the same interface so you can switch depending on whether an X display is available

Here is a dialog script that displays a simple YES/NO box:

#!/bin/bash
DIALOG=${DIALOG=dialog}

$DIALOG --title " My first dialog" --clear 
        --yesno "Hello , this is my first dialog program" 10 30

case $? in
  0)
    echo "Yes chosen.";;
  1)
    echo "No chosen.";;
  255)
    echo "ESC pressed.";;
esac

enter image description here

Replacing dialog by xdialog:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...