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?
The dialog command allows you to display a variety of questions or display messages using dialog boxes from a shell script. Use the dialog utility for creating TTY (terminal) dialog boxes.
$_ (dollar underscore) is another special bash parameter and used to reference the absolute file name of the shell or bash script which is being executed as specified in the argument list. This bash parameter is also used to hold the name of mail file while checking emails.
By default you can open it with Alt - F2 or Alt - Space .
Dialog is an application used in shell scripts which displays text user interface widgets. It uses the curses or ncurses library. The latter provides users with the ability to use a mouse, e.g., in an xterm. dialog. Dialog - editbox widget.
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
Replacing dialog
by xdialog
:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With