1DIALOG(1) General Commands Manual DIALOG(1)
2
3
4
6 dialog - display dialog boxes from shell scripts
7
9 dialog --clear
10 dialog --create-rc file
11 dialog --print-maxsize
12 dialog common-options box-options
13
15 Dialog is a program that will let you present a variety of questions or
16 display messages using dialog boxes from a shell script. These types
17 of dialog boxes are implemented (though not all are necessarily com‐
18 piled into dialog):
19
20 buildlist, calendar, checklist, dselect, editbox, form, fselect,
21 gauge, infobox, inputbox, inputmenu, menu, mixedform,
22 mixedgauge, msgbox (message), passwordbox, passwordform, pause,
23 prgbox, programbox, progressbox, radiolist, rangebox, tailbox,
24 tailboxbg, textbox, timebox, treeview, and yesno (yes/no).
25
26 You can put more than one dialog box into a script:
27
28 · Use the "--and-widget" token to force dialog to proceed to the next
29 dialog unless you have pressed ESC to cancel, or
30
31 · Simply add the tokens for the next dialog box, making a chain. Di‐
32 alog stops chaining when the return code from a dialog is nonzero,
33 e.g., Cancel or No (see DIAGNOSTICS).
34
35 Some widgets, e.g., checklist, will write text to dialog's output.
36 Normally that is the standard error, but there are options for changing
37 this: "--output-fd", "--stderr" and "--stdout". No text is written if
38 the Cancel button (or ESC) is pressed; dialog exits immediately in that
39 case.
40
42 All options begin with "--" (two ASCII hyphens, for the benefit of
43 those using systems with deranged locale support).
44
45 A "--" by itself is used as an escape, i.e., the next token on the com‐
46 mand-line is not treated as an option.
47 dialog --title -- --Not an option
48
49 The "--args" option tells dialog to list the command-line parameters to
50 the standard error. This is useful when debugging complex scripts us‐
51 ing the "--" and "--file", since the command-line may be rewritten as
52 these are expanded.
53
54 The "--file" option tells dialog to read parameters from the file named
55 as its value.
56 dialog --file parameterfile
57 Blanks not within double-quotes are discarded (use backslashes to quote
58 single characters). The result is inserted into the command-line, re‐
59 placing "--file" and its option value. Interpretation of the command-
60 line resumes from that point. If parameterfile begins with "&", dialog
61 interprets the following text as a file descriptor number rather than a
62 filename.
63
64 Common Options
65 Most of the common options are reset before processing each widget.
66
67 --ascii-lines
68 Rather than draw graphics lines around boxes, draw ASCII "+" and
69 "-" in the same place. See also "--no-lines".
70
71 --aspect ratio
72 This gives you some control over the box dimensions when using
73 auto sizing (specifying 0 for height and width). It represents
74 width / height. The default is 9, which means 9 characters wide
75 to every 1 line high.
76
77 --backtitle backtitle
78 Specifies a backtitle string to be displayed on the backdrop, at
79 the top of the screen.
80
81 --begin y x
82 Specify the position of the upper left corner of a dialog box on
83 the screen.
84
85 --cancel-label string
86 Override the label used for "Cancel" buttons.
87
88 --clear
89 Clears the widget screen, keeping only the screen_color back‐
90 ground. Use this when you combine widgets with "--and-widget"
91 to erase the contents of a previous widget on the screen, so it
92 won't be seen under the contents of a following widget. Under‐
93 stand this as the complement of "--keep-window". To compare the
94 effects, use these:
95
96 All three widgets visible, staircase effect, ordered 1,2,3:
97
98 dialog \
99 --begin 2 2 --yesno "" 0 0 \
100 --and-widget --begin 4 4 --yesno "" 0 0 \
101 --and-widget --begin 6 6 --yesno "" 0 0
102
103 Only the last widget is left visible:
104
105 dialog \
106 --clear --begin 2 2 --yesno "" 0 0 \
107 --and-widget --clear --begin 4 4 --yesno "" 0 0 \
108 --and-widget --begin 6 6 --yesno "" 0 0
109
110 All three widgets visible, staircase effect, ordered 3,2,1:
111
112 dialog \
113 --keep-window --begin 2 2 --yesno "" 0 0 \
114 --and-widget --keep-window --begin 4 4 --yesno "" 0 0 \
115 --and-widget --begin 6 6 --yesno "" 0 0
116
117 First and third widget visible, staircase effect, ordered 3,1:
118
119 dialog \
120 --keep-window --begin 2 2 --yesno "" 0 0 \
121 --and-widget --clear --begin 4 4 --yesno "" 0 0 \
122 --and-widget --begin 6 6 --yesno "" 0 0
123
124 Note, if you want to restore original console colors and send
125 your cursor home after the dialog program has exited, use the
126 clear (1) command.
127
128 --colors
129 Interpret embedded "\Z" sequences in the dialog text by the fol‐
130 lowing character, which tells dialog to set colors or video at‐
131 tributes:
132
133 · 0 through 7 are the ANSI color numbers used in curses:
134 black, red, green, yellow, blue, magenta, cyan and white re‐
135 spectively.
136
137 · Bold is set by 'b', reset by 'B'.
138
139 · Reverse is set by 'r', reset by 'R'.
140
141 · Underline is set by 'u', reset by 'U'.
142
143 · The settings are cumulative, e.g., "\Zb\Z1" makes the fol‐
144 lowing text bold (perhaps bright) red.
145
146 · Restore normal settings with "\Zn".
147
148 --column-separator string
149 Tell dialog to split data for radio/checkboxes and menus on the
150 occurrences of the given string, and to align the split data in‐
151 to columns.
152
153 --cr-wrap
154 Interpret embedded newlines in the dialog text as a newline on
155 the screen. Otherwise, dialog will only wrap lines where needed
156 to fit inside the text box.
157
158 Even though you can control line breaks with this, Dialog will
159 still wrap any lines that are too long for the width of the box.
160 Without cr-wrap, the layout of your text may be formatted to
161 look nice in the source code of your script without affecting
162 the way it will look in the dialog.
163
164 See also the "--no-collapse" and "--trim" options.
165
166 --create-rc file
167 When dialog supports run-time configuration, this can be used to
168 dump a sample configuration file to the file specified by file.
169
170 --date-format format
171 If the host provides strftime, this option allows you to specify
172 the format of the date printed for the --calendar widget. The
173 time of day (hour, minute, second) are the current local time.
174
175 --defaultno
176 Make the default value of the yes/no box a No. Likewise, make
177 the default button of widgets that provide "OK" and "Cancel" a
178 Cancel. If "--nocancel" or "--visit-items" are given those op‐
179 tions overrides this, making the default button always "Yes"
180 (internally the same as "OK").
181
182 --default-button string
183 Set the default (preselected) button in a widget. By preselect‐
184 ing a button, a script makes it possible for the user to simply
185 press Enter to proceed through a dialog with minimum interac‐
186 tion.
187
188 The option's value is the name of the button: ok, yes, cancel,
189 no, help or extra.
190
191 Normally the first button in each widget is the default. The
192 first button shown is determined by the widget together with the
193 "--nook" and "--nocancel options. If this option is not given,
194 there is no default button assigned.
195
196 --default-item string
197 Set the default item in a checklist, form or menu box. Normally
198 the first item in the box is the default.
199
200 --exit-label string
201 Override the label used for "EXIT" buttons.
202
203 --extra-button
204 Show an extra button, between "OK" and "Cancel" buttons.
205
206 --extra-label string
207 Override the label used for "Extra" buttons. Note: for input‐
208 menu widgets, this defaults to "Rename".
209
210 --help Prints the help message to the standard output and exits. The
211 help message is also printed if no options are given, or if an
212 unrecognized option is given.
213
214 --help-button
215 Show a help-button after "OK" and "Cancel" buttons, i.e., in
216 checklist, radiolist and menu boxes.
217
218 On exit, the return status will indicate that the Help button
219 was pressed. Dialog will also write a message to its output af‐
220 ter the token "HELP":
221
222 · If "--item-help" is also given, the item-help text will be
223 written.
224
225 · Otherwise, the item's tag (the first field) will be written.
226
227 You can use the --help-tags option and/or set the DIA‐
228 LOG_ITEM_HELP environment variable to modify these messages and
229 exit-status.
230
231 --help-label string
232 Override the label used for "Help" buttons.
233
234 --help-status
235 If the help-button is selected, writes the checklist, radiolist
236 or form information after the item-help "HELP" information.
237 This can be used to reconstruct the state of a checklist after
238 processing the help request.
239
240 --help-tags
241 Modify the messages written on exit for --help-button by making
242 them always just the item's tag. This does not affect the exit
243 status code.
244
245 --hfile filename
246 Display the given file using a textbox when the user presses F1.
247
248 --hline string
249 Display the given string centered at the bottom of the widget.
250
251 --ignore
252 Ignore options that dialog does not recognize. Some well-known
253 ones such as "--icon" are ignored anyway, but this is a better
254 choice for compatibility with other implementations.
255
256 --input-fd fd
257 Read keyboard input from the given file descriptor. Most dialog
258 scripts read from the standard input, but the gauge widget reads
259 a pipe (which is always standard input). Some configurations do
260 not work properly when dialog tries to reopen the terminal. Use
261 this option (with appropriate juggling of file-descriptors) if
262 your script must work in that type of environment.
263
264 --insecure
265 Makes the password widget friendlier but less secure, by echoing
266 asterisks for each character.
267
268 --iso-week
269 Set the starting point for the week-number shown in the "--cal‐
270 endar" option according to ISO-8601, which starts numbering with
271 the first week which includes a Thursday in January.
272
273 --item-help
274 Interpret the tags data for checklist, radiolist and menu boxes
275 adding a column which is displayed in the bottom line of the
276 screen, for the currently selected item.
277
278 --keep-tite
279 When built with ncurses, dialog normally checks to see if it is
280 running in an xterm, and in that case tries to suppress the ini‐
281 tialization strings that would make it switch to the alternate
282 screen. Switching between the normal and alternate screens is
283 visually distracting in a script which runs dialog several
284 times. Use this option to allow dialog to use those initializa‐
285 tion strings.
286
287 --keep-window
288 Normally when dialog performs several tailboxbg widgets connect‐
289 ed by "--and-widget", it clears the old widget from the screen
290 by painting over it. Use this option to suppress that repaint‐
291 ing.
292
293 At exit, dialog repaints all of the widgets which have been
294 marked with "--keep-window", even if they are not tailboxbg wid‐
295 gets. That causes them to be repainted in reverse order. See
296 the discussion of the "--clear" option for examples.
297
298 --last-key
299 At exit, report the last key which the user entered. This is
300 the curses key code rather than a symbol or literal character.
301 It can be used by scripts to distinguish between two keys which
302 are bound to the same action.
303
304 --max-input size
305 Limit input strings to the given size. If not specified, the
306 limit is 2048.
307
308 --no-cancel
309
310 --nocancel
311 Suppress the "Cancel" button in checklist, inputbox and menu box
312 modes. A script can still test if the user pressed the ESC key
313 to cancel to quit.
314
315 --no-collapse
316 Normally dialog converts tabs to spaces and reduces multiple
317 spaces to a single space for text which is displayed in a mes‐
318 sage boxes, etc. Use this option to disable that feature. Note
319 that dialog will still wrap text, subject to the "--cr-wrap" and
320 "--trim" options.
321
322 --no-items
323 Some widgets (checklist, inputmenu, radiolist, menu) display a
324 list with two columns (a "tag" and "item", i.e., "description").
325 This option tells dialog to read shorter rows, omitting the
326 "item" part of the list. This is occasionally useful, e.g., if
327 the tags provide enough information.
328
329 See also --no-tags. If both options are given, this one is ig‐
330 nored.
331
332 --no-kill
333 Tells dialog to put the tailboxbg box in the background, print‐
334 ing its process id to dialog's output. SIGHUP is disabled for
335 the background process.
336
337 --no-label string
338 Override the label used for "No" buttons.
339
340 --no-lines
341 Rather than draw lines around boxes, draw spaces in the same
342 place. See also "--ascii-lines".
343
344 --no-mouse
345 Do not enable the mouse.
346
347 --no-nl-expand
348 Do not convert "\n" substrings of the message/prompt text into
349 literal newlines.
350
351 --no-ok
352
353 --nook Suppress the "OK" button in checklist, inputbox and menu box
354 modes. A script can still test if the user pressed the "Enter"
355 key to accept the data.
356
357 --no-shadow
358 Suppress shadows that would be drawn to the right and bottom of
359 each dialog box.
360
361 --no-tags
362 Some widgets (checklist, inputmenu, radiolist, menu) display a
363 list with two columns (a "tag" and "description"). The tag is
364 useful for scripting, but may not help the user. The --no-tags
365 option (from Xdialog) may be used to suppress the column of tags
366 from the display. Unlike the --no-items option, this does not
367 affect the data which is read from the script.
368
369 Xdialog does not display the tag column for the analogous
370 buildlist and treeview widgets; dialog does the same.
371
372 Normally dialog allows you to quickly move to entries on the
373 displayed list, by matching a single character to the first
374 character of the tag. When the --no-tags option is given, dia‐
375 log matches against the first character of the description. In
376 either case, the matchable character is highlighted.
377
378 --ok-label string
379 Override the label used for "OK" buttons.
380
381 --output-fd fd
382 Direct output to the given file descriptor. Most dialog scripts
383 write to the standard error, but error messages may also be
384 written there, depending on your script.
385
386 --separator string
387
388 --output-separatorstring
389 Specify a string that will separate the output on dialog's out‐
390 put from checklists, rather than a newline (for --separate-out‐
391 put) or a space. This applies to other widgets such as forms
392 and editboxes which normally use a newline.
393
394 --print-maxsize
395 Print the maximum size of dialog boxes, i.e., the screen size,
396 to dialog's output. This may be used alone, without other op‐
397 tions.
398
399 --print-size
400 Prints the size of each dialog box to dialog's output.
401
402 --print-version
403 Prints dialog's version to dialog's output. This may be used
404 alone, without other options. It does not cause dialog to exit
405 by itself.
406
407 --quoted
408 Normally dialog quotes the strings returned by checklist's as
409 well as the item-help text. Use this option to quote all string
410 results.
411
412 --reorder
413 By default, the buildlist widget uses the same order for the
414 output (right) list as for the input (left). Use this option to
415 tell dialog to use the order in which a user adds selections to
416 the output list.
417
418 --scrollbar
419 For widgets holding a scrollable set of data, draw a scrollbar
420 on its right-margin. This does not respond to the mouse.
421
422 --separate-output
423 For certain widgets (buildlist, checklist, treeview), output re‐
424 sult one line at a time, with no quoting. This facilitates
425 parsing by another program.
426
427 --separate-widget string
428 Specify a string that will separate the output on dialog's out‐
429 put from each widget. This is used to simplify parsing the re‐
430 sult of a dialog with several widgets. If this option is not
431 given, the default separator string is a tab character.
432
433 --shadow
434 Draw a shadow to the right and bottom of each dialog box.
435
436 --single-quoted
437 Use single-quoting as needed (and no quotes if unneeded) for the
438 output of checklist's as well as the item-help text. If this
439 option is not set, dialog uses double quotes around each item.
440 In either case, dialog adds backslashes to make the output use‐
441 ful in shell scripts.
442
443 --size-err
444 Check the resulting size of a dialog box before trying to use
445 it, printing the resulting size if it is larger than the screen.
446 (This option is obsolete, since all new-window calls are
447 checked).
448
449 --sleep secs
450 Sleep (delay) for the given number of seconds after processing a
451 dialog box.
452
453 --stderr
454 Direct output to the standard error. This is the default, since
455 curses normally writes screen updates to the standard output.
456
457 --stdout
458 Direct output to the standard output. This option is provided
459 for compatibility with Xdialog, however using it in portable
460 scripts is not recommended, since curses normally writes its
461 screen updates to the standard output. If you use this option,
462 dialog attempts to reopen the terminal so it can write to the
463 display. Depending on the platform and your environment, that
464 may fail.
465
466 --tab-correct
467 Convert each tab character to one or more spaces (for the
468 textbox widget; otherwise to a single space). Otherwise, tabs
469 are rendered according to the curses library's interpretation.
470 The --no-collapse option disables tab expansion.
471
472 --tab-len n
473 Specify the number of spaces that a tab character occupies if
474 the "--tab-correct" option is given. The default is 8. This
475 option is only effective for the textbox widget.
476
477 --time-format format
478 If the host provides strftime, this option allows you to specify
479 the format of the time printed for the --timebox widget. The
480 day, month, year values in this case are for the current local
481 time.
482
483 --timeout secs
484 Timeout (exit with error code) if no user response within the
485 given number of seconds. A timeout of zero seconds is ignored.
486
487 This option is ignored by the "--pause" widget. It is also
488 overridden if the background "--tailboxbg" option is used to
489 setup multiple concurrent widgets.
490
491 --title title
492 Specifies a title string to be displayed at the top of the dia‐
493 log box.
494
495 --trace filename
496 logs the command-line parameters, keystrokes and other informa‐
497 tion to the given file. If dialog reads a configure file, it is
498 logged as well. Piped input to the gauge widget is logged. Use
499 control/T to log a picture of the current dialog window.
500
501 --week-start day
502 sets the starting day for the week, used in the "--calendar" op‐
503 tion. The day parameter can be
504
505 · a number (0 to 6, Sunday through Saturday using POSIX) or
506
507 · the special value "locale" (this works with systems using
508 glibc, providing an extension to the locale command, the
509 first_weekday value).
510
511 · a string matching one of the abbreviations for the day of
512 the week shown in the calendar widget, e.g., "Mo" for "Mon‐
513 day".
514
515 The dialog program handles some command-line parameters specially, and
516 removes them from the parameter list as they are processed. For exam‐
517 ple, if the first option is --trace, then that is processed (and re‐
518 moved) before dialog initializes the display.
519
520 --trim eliminate leading blanks, trim literal newlines and repeated
521 blanks from message text.
522
523 See also the "--cr-wrap" and "--no-collapse" options.
524
525 --version
526 Prints dialog's version to the standard output, and exits. See
527 also "--print-version".
528
529 --visit-items
530 Modify the tab-traversal of checklist, radiolist, menubox and
531 inputmenu to include the list of items as one of the states.
532 This is useful as a visual aid, i.e., the cursor position helps
533 some users.
534
535 When this option is given, the cursor is initially placed on the
536 list. Abbreviations (the first letter of the tag) apply to the
537 list items. If you tab to the button row, abbreviations apply
538 to the buttons.
539
540 --yes-label string
541 Override the label used for "Yes" buttons.
542
543 Box Options
544 All dialog boxes have at least three parameters:
545
546 text the caption or contents of the box.
547
548 height the height of the dialog box.
549
550 width the width of the dialog box.
551
552 Other parameters depend on the box type.
553
554 --buildlist text height width list-height [ tag item status ] ...
555 A buildlist dialog displays two lists, side-by-side. The list
556 on the left shows unselected items. The list on the right shows
557 selected items. As items are selected or unselected, they move
558 between the lists.
559
560 Use a carriage return or the "OK" button to accept the current
561 value in the selected-window and exit. The results are written
562 using the order displayed in the selected-window.
563
564 The initial on/off state of each entry is specified by status.
565
566 The dialog behaves like a menu, using the --visit-items to con‐
567 trol whether the cursor is allowed to visit the lists directly.
568
569 · If --visit-items is not given, tab-traversal uses two states
570 (OK/Cancel).
571
572 · If --visit-items is given, tab-traversal uses four states
573 (Left/Right/OK/Cancel).
574
575 Whether or not --visit-items is given, it is possible to move
576 the highlight between the two lists using the default "^" (left-
577 column) and "$" (right-column) keys.
578
579 On exit, a list of the tag strings of those entries that are
580 turned on will be printed on dialog's output.
581
582 If the "--separate-output" option is not given, the strings will
583 be quoted as needed to make it simple for scripts to separate
584 them. By default, this uses double-quotes. See the "--single-
585 quoted" option, which modifies the quoting behavior.
586
587 --calendar text height width day month year
588 A calendar box displays month, day and year in separately ad‐
589 justable windows. If the values for day, month or year are
590 missing or negative, the current date's corresponding values are
591 used. You can increment or decrement any of those using the
592 left-, up-, right-, and down-arrows. Use vi-style h, j, k and l
593 for moving around the array of days in a month. Use tab or
594 backtab to move between windows. If the year is given as zero,
595 the current date is used as an initial value.
596
597 On exit, the date is printed in the form day/month/year. The
598 format can be overridden using the --date-format option.
599
600 --checklist text height width list-height [ tag item status ] ...
601 A checklist box is similar to a menu box; there are multiple en‐
602 tries presented in the form of a menu. Another difference is
603 that you can indicate which entry is currently selected, by set‐
604 ting its status to on. Instead of choosing one entry among the
605 entries, each entry can be turned on or off by the user. The
606 initial on/off state of each entry is specified by status.
607
608 On exit, a list of the tag strings of those entries that are
609 turned on will be printed on dialog's output.
610
611 If the "--separate-output" option is not given, the strings will
612 be quoted as needed to make it simple for scripts to separate
613 them. By default, this uses double-quotes. See the "--single-
614 quoted" option, which modifies the quoting behavior.
615
616 --dselect filepath height width
617 The directory-selection dialog displays a text-entry window in
618 which you can type a directory, and above that a windows with
619 directory names.
620
621 Here filepath can be a filepath in which case the directory win‐
622 dow will display the contents of the path and the text-entry
623 window will contain the preselected directory.
624
625 Use tab or arrow keys to move between the windows. Within the
626 directory window, use the up/down arrow keys to scroll the cur‐
627 rent selection. Use the space-bar to copy the current selection
628 into the text-entry window.
629
630 Typing any printable characters switches focus to the text-entry
631 window, entering that character as well as scrolling the direc‐
632 tory window to the closest match.
633
634 Use a carriage return or the "OK" button to accept the current
635 value in the text-entry window and exit.
636
637 On exit, the contents of the text-entry window are written to
638 dialog's output.
639
640 --editbox filepath height width
641 The edit-box dialog displays a copy of the file. You may edit
642 it using the backspace, delete and cursor keys to correct typing
643 errors. It also recognizes pageup/pagedown. Unlike the --in‐
644 putbox, you must tab to the "OK" or "Cancel" buttons to close
645 the dialog. Pressing the "Enter" key within the box will split
646 the corresponding line.
647
648 On exit, the contents of the edit window are written to dialog's
649 output.
650
651 --form text height width formheight [ label y x item y x flen ilen ] ...
652 The form dialog displays a form consisting of labels and fields,
653 which are positioned on a scrollable window by coordinates given
654 in the script. The field length flen and input-length ilen tell
655 how long the field can be. The former defines the length shown
656 for a selected field, while the latter defines the permissible
657 length of the data entered in the field.
658
659 · If flen is zero, the corresponding field cannot be altered.
660 and the contents of the field determine the displayed-
661 length.
662
663 · If flen is negative, the corresponding field cannot be al‐
664 tered, and the negated value of flen is used as the dis‐
665 played-length.
666
667 · If ilen is zero, it is set to flen.
668
669 Use up/down arrows (or control/N, control/P) to move between
670 fields. Use tab to move between windows.
671
672 On exit, the contents of the form-fields are written to dialog's
673 output, each field separated by a newline. The text used to
674 fill non-editable fields (flen is zero or negative) is not writ‐
675 ten out.
676
677 --fselect filepath height width
678 The fselect (file-selection) dialog displays a text-entry window
679 in which you can type a filename (or directory), and above that
680 two windows with directory names and filenames.
681
682 Here filepath can be a filepath in which case the file and di‐
683 rectory windows will display the contents of the path and the
684 text-entry window will contain the preselected filename.
685
686 Use tab or arrow keys to move between the windows. Within the
687 directory or filename windows, use the up/down arrow keys to
688 scroll the current selection. Use the space-bar to copy the
689 current selection into the text-entry window.
690
691 Typing any printable characters switches focus to the text-entry
692 window, entering that character as well as scrolling the direc‐
693 tory and filename windows to the closest match.
694
695 Typing the space character forces dialog to complete the current
696 name (up to the point where there may be a match against more
697 than one entry).
698
699 Use a carriage return or the "OK" button to accept the current
700 value in the text-entry window and exit.
701
702 On exit, the contents of the text-entry window are written to
703 dialog's output.
704
705 --gauge text height width [percent]
706 A gauge box displays a meter along the bottom of the box. The
707 meter indicates the percentage. New percentages are read from
708 standard input, one integer per line. The meter is updated to
709 reflect each new percentage. If the standard input reads the
710 string "XXX", then the first line following is taken as an inte‐
711 ger percentage, then subsequent lines up to another "XXX" are
712 used for a new prompt. The gauge exits when EOF is reached on
713 the standard input.
714
715 The percent value denotes the initial percentage shown in the
716 meter. If not specified, it is zero.
717
718 On exit, no text is written to dialog's output. The widget ac‐
719 cepts no input, so the exit status is always OK.
720
721 --infobox text height width
722 An info box is basically a message box. However, in this case,
723 dialog will exit immediately after displaying the message to the
724 user. The screen is not cleared when dialog exits, so that the
725 message will remain on the screen until the calling shell script
726 clears it later. This is useful when you want to inform the us‐
727 er that some operations are carrying on that may require some
728 time to finish.
729
730 On exit, no text is written to dialog's output. An OK exit sta‐
731 tus is returned.
732
733 --inputbox text height width [init]
734 An input box is useful when you want to ask questions that re‐
735 quire the user to input a string as the answer. If init is sup‐
736 plied it is used to initialize the input string. When entering
737 the string, the backspace, delete and cursor keys can be used to
738 correct typing errors. If the input string is longer than can
739 fit in the dialog box, the input field will be scrolled.
740
741 On exit, the input string will be printed on dialog's output.
742
743 --inputmenu text height width menu-height [ tag item ] ...
744 An inputmenu box is very similar to an ordinary menu box. There
745 are only a few differences between them:
746
747 1. The entries are not automatically centered but left adjust‐
748 ed.
749
750 2. An extra button (called Rename) is implied to rename the
751 current item when it is pressed.
752
753 3. It is possible to rename the current entry by pressing the
754 Rename button. Then dialog will write the following on dia‐
755 log's output.
756
757 RENAMED <tag> <item>
758
759 --menu text height width menu-height [ tag item ] ...
760 As its name suggests, a menu box is a dialog box that can be
761 used to present a list of choices in the form of a menu for the
762 user to choose. Choices are displayed in the order given. Each
763 menu entry consists of a tag string and an item string. The tag
764 gives the entry a name to distinguish it from the other entries
765 in the menu. The item is a short description of the option that
766 the entry represents. The user can move between the menu en‐
767 tries by pressing the cursor keys, the first letter of the tag
768 as a hot-key, or the number keys 1 through 9. There are menu-
769 height entries displayed in the menu at one time, but the menu
770 will be scrolled if there are more entries than that.
771
772 On exit the tag of the chosen menu entry will be printed on dia‐
773 log's output. If the "--help-button" option is given, the cor‐
774 responding help text will be printed if the user selects the
775 help button.
776
777 --mixedform text height width formheight [ label y x item y x flen ilen itype ] ...
778 The mixedform dialog displays a form consisting of labels and
779 fields, much like the --form dialog. It differs by adding a
780 field-type parameter to each field's description. Each bit in
781 the type denotes an attribute of the field:
782
783 1 hidden, e.g., a password field.
784
785 2 readonly, e.g., a label.
786
787 --mixedgauge text height width percent [ tag1 item1 ] ...
788 A mixedgauge box displays a meter along the bottom of the box.
789 The meter indicates the percentage.
790
791 It also displays a list of the tag- and item-values at the top
792 of the box. See dialog(3) for the tag values.
793
794 The text is shown as a caption between the list and meter. The
795 percent value denotes the initial percentage shown in the meter.
796
797 No provision is made for reading data from the standard input as
798 --gauge does.
799
800 On exit, no text is written to dialog's output. The widget ac‐
801 cepts no input, so the exit status is always OK.
802
803 --msgbox text height width
804 A message box is very similar to a yes/no box. The only differ‐
805 ence between a message box and a yes/no box is that a message
806 box has only a single OK button. You can use this dialog box to
807 display any message you like. After reading the message, the
808 user can press the ENTER key so that dialog will exit and the
809 calling shell script can continue its operation.
810
811 If the message is too large for the space, dialog may allow you
812 to scroll it, provided that the underlying curses implementation
813 is capable enough. In this case, a percentage is shown in the
814 base of the widget.
815
816 On exit, no text is written to dialog's output. Only an "OK"
817 button is provided for input, but an ESC exit status may be re‐
818 turned.
819
820 --pause text height width seconds
821 A pause box displays a meter along the bottom of the box. The
822 meter indicates how many seconds remain until the end of the
823 pause. The pause exits when timeout is reached or the user
824 presses the OK button (status OK) or the user presses the CANCEL
825 button or Esc key.
826
827 --passwordbox text height width [init]
828 A password box is similar to an input box, except that the text
829 the user enters is not displayed. This is useful when prompting
830 for passwords or other sensitive information. Be aware that if
831 anything is passed in "init", it will be visible in the system's
832 process table to casual snoopers. Also, it is very confusing to
833 the user to provide them with a default password they cannot
834 see. For these reasons, using "init" is highly discouraged.
835 See "--insecure" if you do not care about your password.
836
837 On exit, the input string will be printed on dialog's output.
838
839 --passwordform text height width formheight [ label y x item y x flen ilen ] ...
840 This is identical to --form except that all text fields are
841 treated as password widgets rather than inputbox widgets.
842
843 --prgbox text command height width
844
845 --prgbox command height width
846 A prgbox is very similar to a programbox.
847
848 This dialog box is used to display the output of a command that
849 is specified as an argument to prgbox.
850
851 After the command completes, the user can press the ENTER key so
852 that dialog will exit and the calling shell script can continue
853 its operation.
854
855 If three parameters are given, it displays the text under the
856 title, delineated from the scrolling file's contents. If only
857 two parameters are given, this text is omitted.
858
859 --programbox text height width
860
861 --programbox height width
862 A programbox is very similar to a progressbox. The only differ‐
863 ence between a program box and a progress box is that a program
864 box displays an OK button (but only after the command com‐
865 pletes).
866
867 This dialog box is used to display the piped output of a com‐
868 mand. After the command completes, the user can press the ENTER
869 key so that dialog will exit and the calling shell script can
870 continue its operation.
871
872 If three parameters are given, it displays the text under the
873 title, delineated from the scrolling file's contents. If only
874 two parameters are given, this text is omitted.
875
876 --progressbox text height width
877
878 --progressbox height width
879 A progressbox is similar to an tailbox, except that
880
881 a) rather than displaying the contents of a file,
882 it displays the piped output of a command and
883
884 b) it will exit when it reaches the end of the file
885 (there is no "OK" button).
886
887 If three parameters are given, it displays the text under the
888 title, delineated from the scrolling file's contents. If only
889 two parameters are given, this text is omitted.
890
891 --radiolist text height width list-height [ tag item status ] ...
892 A radiolist box is similar to a menu box. The only difference
893 is that you can indicate which entry is currently selected, by
894 setting its status to on.
895
896 On exit, the tag of the selected item is written to dialog's
897 output.
898
899 --tailbox file height width
900 Display text from a file in a dialog box, as in a "tail -f" com‐
901 mand. Scroll left/right using vi-style 'h' and 'l', or arrow-
902 keys. A '0' resets the scrolling.
903
904 On exit, no text is written to dialog's output. Only an "OK"
905 button is provided for input, but an ESC exit status may be re‐
906 turned.
907
908 --rangebox text height width min-value max-value default-value
909 Allow the user to select from a range of values, e.g., using a
910 slider. The dialog shows the current value as a bar (like the
911 gauge dialog). Tabs or arrow keys move the cursor between the
912 buttons and the value. When the cursor is on the value, you can
913 edit it by:
914
915 left/right cursor movement to select a digit to modify
916
917 +/- characters to increment/decrement the digit by one
918
919 0 through 9
920 to set the digit to the given value
921
922 Some keys are also recognized in all cursor positions:
923
924 home/end
925 set the value to its maximum or minimum
926
927 pageup/pagedown
928 increment the value so that the slider moves by one column
929
930 --tailboxbg file height width
931 Display text from a file in a dialog box as a background task,
932 as in a "tail -f &" command. Scroll left/right using vi-style
933 'h' and 'l', or arrow-keys. A '0' resets the scrolling.
934
935 Dialog treats the background task specially if there are other
936 widgets (--and-widget) on the screen concurrently. Until those
937 widgets are closed (e.g., an "OK"), dialog will perform all of
938 the tailboxbg widgets in the same process, polling for updates.
939 You may use a tab to traverse between the widgets on the screen,
940 and close them individually, e.g., by pressing ENTER. Once the
941 non-tailboxbg widgets are closed, dialog forks a copy of itself
942 into the background, and prints its process id if the "--no-
943 kill" option is given.
944
945 On exit, no text is written to dialog's output. Only an "EXIT"
946 button is provided for input, but an ESC exit status may be re‐
947 turned.
948
949 NOTE: Older versions of dialog forked immediately and attempted
950 to update the screen individually. Besides being bad for per‐
951 formance, it was unworkable. Some older scripts may not work
952 properly with the polled scheme.
953
954 --textbox file height width
955 A text box lets you display the contents of a text file in a di‐
956 alog box. It is like a simple text file viewer. The user can
957 move through the file by using the cursor, page-up, page-down
958 and HOME/END keys available on most keyboards. If the lines are
959 too long to be displayed in the box, the LEFT/RIGHT keys can be
960 used to scroll the text region horizontally. You may also use
961 vi-style keys h, j, k, and l in place of the cursor keys, and B
962 or N in place of the page-up and page-down keys. Scroll up/down
963 using vi-style 'k' and 'j', or arrow-keys. Scroll left/right
964 using vi-style 'h' and 'l', or arrow-keys. A '0' resets the
965 left/right scrolling. For more convenience, vi-style forward
966 and backward searching functions are also provided.
967
968 On exit, no text is written to dialog's output. Only an "EXIT"
969 button is provided for input, but an ESC exit status may be re‐
970 turned.
971
972 --timebox text height [width hour minute second]
973 A dialog is displayed which allows you to select hour, minute
974 and second. If the values for hour, minute or second are miss‐
975 ing or negative, the current date's corresponding values are
976 used. You can increment or decrement any of those using the
977 left-, up-, right- and down-arrows. Use tab or backtab to move
978 between windows.
979
980 On exit, the result is printed in the form hour:minute:second.
981 The format can be overridden using the --time-format option.
982
983 --treeview text height width list-height [ tag item status depth ] ...
984 Display data organized as a tree. Each group of data contains a
985 tag, the text to display for the item, its status ("on" or
986 "off") and the depth of the item in the tree.
987
988 Only one item can be selected (like the radiolist). The tag is
989 not displayed.
990
991 On exit, the tag of the selected item is written to dialog's
992 output.
993
994 --yesno text height width
995 A yes/no dialog box of size height rows by width columns will be
996 displayed. The string specified by text is displayed inside the
997 dialog box. If this string is too long to fit in one line, it
998 will be automatically divided into multiple lines at appropriate
999 places. The text string can also contain the sub-string "\n" or
1000 newline characters `\n' to control line breaking explicitly.
1001 This dialog box is useful for asking questions that require the
1002 user to answer either yes or no. The dialog box has a Yes but‐
1003 ton and a No button, in which the user can switch between by
1004 pressing the TAB key.
1005
1006 On exit, no text is written to dialog's output. In addition to
1007 the "Yes" and "No" exit codes (see DIAGNOSTICS) an ESC exit sta‐
1008 tus may be returned.
1009
1010 The codes used for "Yes" and "No" match those used for "OK" and
1011 "Cancel", internally no distinction is made.
1012
1013 Obsolete Options
1014 --beep This was used to tell the original cdialog that it should make a
1015 beep when the separate processes of the tailboxbg widget would
1016 repaint the screen.
1017
1018 --beep-after
1019 Beep after a user has completed a widget by pressing one of the
1020 buttons.
1021
1023 1. Create a sample configuration file by typing:
1024
1025 dialog --create-rc file
1026
1027 2. At start, dialog determines the settings to use as follows:
1028
1029 a) if environment variable DIALOGRC is set, its value determines
1030 the name of the configuration file.
1031
1032 b) if the file in (a) is not found, use the file $HOME/.dialogrc
1033 as the configuration file.
1034
1035 c) if the file in (b) is not found, try using the GLOBALRC file
1036 determined at compile-time, i.e., /etc/dialogrc.
1037
1038 d) if the file in (c) is not found, use compiled in defaults.
1039
1040 3. Edit the sample configuration file and copy it to some place that
1041 dialog can find, as stated in step 2 above.
1042
1044 You can override or add to key bindings in dialog by adding to the con‐
1045 figuration file. Dialog's bindkey command maps single keys to its in‐
1046 ternal coding.
1047
1048 bindkey widget curses_key dialog_key
1049
1050 The widget name can be "*" (all widgets), or specific widgets such as
1051 textbox. Specific widget bindings override the "*" bindings. User-de‐
1052 fined bindings override the built-in bindings.
1053
1054 The curses_key can be any of the names derived from curses.h, e.g.,
1055 "HELP" from "KEY_HELP". Dialog also recognizes ANSI control characters
1056 such as "^A", "^?", as well as C1-controls such as "~A" and "~?". Fi‐
1057 nally, it allows any single character to be escaped with a backslash.
1058
1059 Dialog's internal keycode names correspond to the DLG_KEYS_ENUM type in
1060 dlg_keys.h, e.g., "HELP" from "DLGK_HELP".
1061
1062 Widget Names
1063 Some widgets (such as the formbox) have an area where fields can be
1064 edited. Those are managed in a subwindow of the widget, and may have
1065 separate keybindings from the main widget because the subwindows are
1066 registered using a different name.
1067
1068 Widget Window name Subwindow Name
1069 ───────────────────────────────────────────
1070 calendar calendar
1071 checklist checklist
1072 editbox editbox editbox2
1073 form formbox formfield
1074
1075 fselect fselect fselect2
1076 inputbox inputbox inputbox2
1077 menu menubox menu
1078 msgbox msgbox
1079 pause pause
1080 progressbox progressbox
1081 radiolist radiolist
1082 tailbox tailbox
1083 textbox textbox searchbox
1084 timebox timebox
1085 yesno yesno
1086 ───────────────────────────────────────────
1087
1088 Some widgets are actually other widgets, using internal settings to
1089 modify the behavior. Those use the same widget name as the actual wid‐
1090 get:
1091
1092 Widget Actual Widget
1093 ─────────────────────────────
1094 dselect fselect
1095 infobox msgbox
1096 inputmenu menu
1097 mixedform form
1098 passwordbox inputbox
1099 passwordform form
1100 prgbox progressbox
1101 programbox progressbox
1102 tailboxbg tailbox
1103 ─────────────────────────────
1104
1105 Built-in Bindings
1106 This manual page does not list the key bindings for each widget, be‐
1107 cause that detailed information can be obtained by running dialog. If
1108 you have set the --trace option, dialog writes the key-binding informa‐
1109 tion for each widget as it is registered.
1110
1111 Example
1112 Normally dialog uses different keys for navigating between the buttons
1113 and editing part of a dialog versus navigating within the editing part.
1114 That is, tab (and back-tab) traverse buttons (or between buttons and
1115 the editing part), while arrow keys traverse fields within the editing
1116 part. Tabs are also recognized as a special case for traversing be‐
1117 tween widgets, e.g., when using multiple tailboxbg widgets.
1118
1119 Some users may wish to use the same key for traversing within the edit‐
1120 ing part as for traversing between buttons. The form widget is written
1121 to support this sort of redefinition of the keys, by adding a special
1122 group in dlgk_keys.h for "form" (left/right/next/prev). Here is an ex‐
1123 ample binding demonstrating how to do this:
1124
1125 bindkey formfield TAB form_NEXT
1126 bindkey formbox TAB form_NEXT
1127 bindkey formfield BTAB form_prev
1128 bindkey formbox BTAB form_prev
1129
1130 That type of redefinition would not be useful in other widgets, e.g.,
1131 calendar, due to the potentially large number of fields to traverse.
1132
1134 DIALOGOPTS Define this variable to apply any of the common options
1135 to each widget. Most of the common options are reset
1136 before processing each widget. If you set the options
1137 in this environment variable, they are applied to dia‐
1138 log's state after the reset. As in the "--file" option,
1139 double-quotes and backslashes are interpreted.
1140
1141 The "--file" option is not considered a common option
1142 (so you cannot embed it within this environment vari‐
1143 able).
1144
1145 DIALOGRC Define this variable if you want to specify the name of
1146 the configuration file to use.
1147
1148 DIALOG_CANCEL
1149
1150 DIALOG_ERROR
1151
1152 DIALOG_ESC
1153
1154 DIALOG_EXTRA
1155
1156 DIALOG_HELP
1157
1158 DIALOG_ITEM_HELP
1159
1160 DIALOG_OK Define any of these variables to change the exit code on
1161 Cancel (1), error (-1), ESC (255), Extra (3), Help (2),
1162 Help with --item-help [22m(2), or OK (0). Normally shell
1163 scripts cannot distinguish between -1 and 255.
1164
1165 DIALOG_TTY Set this variable to "1" to provide compatibility with
1166 older versions of dialog which assumed that if the
1167 script redirects the standard output, that the "--std‐
1168 out" option was given.
1169
1171 $HOME/.dialogrc default configuration file
1172
1174 The dialog sources contain several samples of how to use the different
1175 box options and how they look. Just take a look into the directory
1176 samples/ of the source.
1177
1179 Exit status is subject to being overridden by environment variables.
1180 The default values and corresponding environment variables that can
1181 override them are:
1182
1183 0 if the YES or OK button is pressed (DIALOG_OK).
1184
1185 1 if the No or Cancel button is pressed (DIALOG_CANCEL).
1186
1187 2 if the Help button is pressed (DIALOG_HELP),
1188 except as noted below about DIALOG_ITEM_HELP.
1189
1190 3 if the Extra button is pressed (DIALOG_EXTRA).
1191
1192 4 if the Help button is pressed,
1193 and the --item-help option is set
1194 and the DIALOG_ITEM_HELP environment variable is set to 4.
1195
1196 While any of the exit-codes can be overridden using environment
1197 variables, this special case was introduced in 2004 to simplify
1198 compatibility. Dialog uses DIALOG_ITEM_HELP(4) internally, but
1199 unless the environment variable is also set, it changes that to
1200 DIALOG_HELP(2) on exit.
1201
1202 -1 if errors occur inside dialog (DIALOG_ERROR) or dialog exits be‐
1203 cause the ESC key (DIALOG_ESC) was pressed.
1204
1206 Dialog works with X/Open curses. However, some implementations have
1207 deficiencies:
1208
1209 · HPUX curses (and perhaps others) do not open the terminal prop‐
1210 erly for the newterm function. This interferes with dialog's
1211 --input-fd option, by preventing cursor-keys and similar escape
1212 sequences from being recognized.
1213
1214 · NetBSD 5.1 curses has incomplete support for wide-characters.
1215 dialog will build, but not all examples display properly.
1216
1218 You may want to write scripts which run with other dialog "clones".
1219
1220 ORIGINAL DIALOG
1221 First, there is the "original" dialog program to consider (versions 0.3
1222 to 0.9). It had some misspelled (or inconsistent) options. The dialog
1223 program maps those deprecated options to the preferred ones. They in‐
1224 clude:
1225
1226 Option Treatment
1227 ─────────────────────────────────
1228 --beep-after ignored
1229 --guage mapped to --gauge
1230 ─────────────────────────────────
1231
1232 XDIALOG
1233 Technically, "Xdialog", this is an X application. With some care, it
1234 is possible to write useful scripts that work with both Xdialog and di‐
1235 alog.
1236
1237 The dialog program ignores these options which are recognized by Xdia‐
1238 log:
1239
1240 Option Treatment
1241 ───────────────────────────────────────────────
1242 --allow-close ignored
1243 --auto-placement ignored
1244 --fixed-font ignored
1245 --icon ignored
1246 --keep-colors ignored
1247 --no-close ignored
1248 --no-cr-wrap ignored
1249 --screen-center ignored
1250 --separator mapped to --separate-output
1251 --smooth ignored
1252 --under-mouse ignored
1253 --wmclass ignored
1254 ───────────────────────────────────────────────
1255
1256 Xdialog's manpage has a section discussing its compatibility with dia‐
1257 log. There are some differences not shown in the manpage. For exam‐
1258 ple, the html documentation states
1259
1260 Note: former Xdialog releases used the "\n" (line feed) as a re‐
1261 sults separator for the checklist widget; this has been changed
1262 to "/" in Xdialog v1.5.0 to make it compatible with (c)dialog.
1263 In your old scripts using the Xdialog checklist, you will then
1264 have to add the --separate-output option before the --checklist
1265 one.
1266
1267 Dialog has not used a different separator; the difference was likely
1268 due to confusion regarding some script.
1269
1270 WHIPTAIL
1271 Then there is whiptail. For practical purposes, it is maintained by
1272 Debian (very little work is done by its upstream developers). Its doc‐
1273 umentation (README.whiptail) claims
1274
1275 whiptail(1) is a lightweight replacement for dialog(1),
1276 to provide dialog boxes for shell scripts.
1277 It is built on the
1278 newt windowing library rather than the ncurses library, allowing
1279 it to be smaller in embedded environments such as installers,
1280 rescue disks, etc.
1281
1282 whiptail is designed to be drop-in compatible with dialog, but
1283 has less features: some dialog boxes are not implemented, such
1284 as tailbox, timebox, calendarbox, etc.
1285
1286 Comparing actual sizes (Debian testing, 2007/1/10): The total of sizes
1287 for whiptail, the newt, popt and slang libraries is 757 KB. The compa‐
1288 rable number for dialog (counting ncurses) is 520 KB. Disregard the
1289 first paragraph.
1290
1291 The second paragraph is misleading, since whiptail also does not work
1292 for common options of dialog, such as the gauge box. whiptail is less
1293 compatible with dialog than the original mid-1990s dialog 0.4 program.
1294
1295 whiptail's manpage borrows features from dialog, e.g., but oddly cites
1296 only dialog versions up to 0.4 (1994) as a source. That is, its man‐
1297 page refers to features which were borrowed from more recent versions
1298 of dialog, e.g.,
1299
1300 · --gauge (from 0.5)
1301
1302 · --passwordbox (from Debian changes in 1999),
1303
1304 · --default-item (from dialog 2000/02/22),
1305
1306 · --output-fd (from dialog 2002/08/14).
1307
1308 Somewhat humorously, one may note that the popt feature (undocumented
1309 in its manpage) of using a "--" as an escape was documented in dialog's
1310 manpage about a year before it was mentioned in whiptail's manpage.
1311 whiptail's manpage incorrectly attributes that to getopt (and is inac‐
1312 curate anyway).
1313
1314 Debian uses whiptail for the official dialog variation.
1315
1316 The dialog program ignores or maps these options which are recognized
1317 by whiptail:
1318
1319 Option Treatment
1320 ───────────────────────────────────────────
1321 --cancel-button mapped to --cancel-label
1322 --fb ignored
1323 --fullbutton ignored
1324 --no-button mapped to --no-label
1325 --nocancel mapped to --no-cancel
1326 --noitem mapped to --no-items
1327 --notags mapped to --no-tags
1328 --ok-button mapped to --ok-label
1329 --scrolltext mapped to --scrollbar
1330 --topleft mapped to --begin 0 0
1331 --yes-button mapped to --yes-label
1332 ───────────────────────────────────────────
1333
1334 There are visual differences which are not addressed by command-line
1335 options:
1336
1337 · dialog centers lists within the window. whiptail typically puts
1338 lists against the left margin.
1339
1340 · whiptail uses angle brackets ("<" and ">") for marking buttons.
1341 dialog uses square brackets.
1342
1343 · whiptail marks the limits of subtitles with vertical bars. dialog
1344 does not mark the limits.
1345
1346 · whiptail attempts to mark the top/bottom cells of a scrollbar with
1347 up/down arrows. When it cannot do this, it fills those cells with
1348 the background color of the scrollbar and confusing the user. dia‐
1349 log uses the entire scrollbar space, thereby getting better resolu‐
1350 tion.
1351
1353 Perhaps.
1354
1356 Thomas E. Dickey (updates for 0.9b and beyond)
1357
1359 Kiran Cherupally – the mixed form and mixed gauge widgets.
1360
1361 Tobias C. Rittweiler
1362
1363 Valery Reznic – the form and progressbox widgets.
1364
1365 Yura Kalinichenko adapted the gauge widget as "pause".
1366
1367 This is a rewrite (except as needed to provide compatibility) of the
1368 earlier version of dialog 0.9a, which lists as authors:
1369
1370 · Savio Lam – version 0.3, "dialog"
1371
1372 · Stuart Herbert – patch for version 0.4
1373
1374 · Marc Ewing – the gauge widget.
1375
1376 · Pasquale De Marco "Pako" – version 0.9a, "cdialog"
1377
1378
1379
1380$Date: 2017/01/31 00:00:07 $ DIALOG(1)